09 2014 档案

摘要:Coffee on the RangeCreate an array with numbers 1 until 10 using the inclusive (two dot) range syntax.[1..10]Coffee on the Range IICreate an array wit... 阅读全文
posted @ 2014-09-30 20:44 Zhentiw 编辑
摘要:ConditionalsMake sure thealertfunction is called onlyif caffeineLevel > 5.alert 'High Caffeine Level' if caffeineLevel > 5Conditionals - Part IICoffee... 阅读全文
posted @ 2014-09-30 19:36 Zhentiw 编辑
摘要:JS to Coffee IConvert the commented jQuery code below to CoffeeScript.# jQuery(function($) {# $('#newCoffee a').click(function() {# alert('New c... 阅读全文
posted @ 2014-09-30 04:30 Zhentiw 编辑
摘要:$scope.$watchNo matter the val changeprogrammatically or munally, it will fire the binded function.With AngularJS's $scope.$watch, you are able to mon... 阅读全文
posted @ 2014-09-30 01:06 Zhentiw 编辑
摘要:RENDERComplete the method below so that if the ammo is low it will render thefire_and_reloadview, otherwise it should render thefire_weaponview.1. In ... 阅读全文
posted @ 2014-09-29 15:22 Zhentiw 编辑
摘要:GENERATE MAILEREnter the command for generating a mailer calledWeaponMailerwhich has the emailslow_ammoandbroken.rails g mailer WeaponMailer boken low... 阅读全文
posted @ 2014-09-27 20:49 Zhentiw 编辑
摘要:Iterating with BlocksLet's build a Library class that will manage our growing collection of games. We've already written alistmethod that prints the n... 阅读全文
posted @ 2014-09-27 02:59 Zhentiw 编辑
摘要:Using Blocks:words = ['Had', 'eggs', 'for', 'breakfast']for index in 0...(words.length-1) puts words[index]endwords = ['Had', 'eggs', 'for', 'break... 阅读全文
posted @ 2014-09-27 02:52 Zhentiw 编辑
摘要:Read More:http://stackoverflow.com/questions/3066703/blocks-and-yields-in-rubyYes, it is a bit puzzling at first.In Ruby, methods may receive a code b... 阅读全文
posted @ 2014-09-27 01:59 Zhentiw 编辑
摘要:1. Namespace:Ruby可以像Javascript一样定义全局的functions。这些functions都放在global namespace中。容易和之后的method name冲突。我们可以用module来包括这些functions。1. module中的方法需要加self:def ... 阅读全文
posted @ 2014-09-27 01:46 Zhentiw 编辑
摘要:NamespacingCreate a module namedGameUtilsand place thelend_to_friendmethod inside the module. Changelend_to_friendto a class method by prefixing it wi... 阅读全文
posted @ 2014-09-27 01:46 Zhentiw 编辑
摘要:ArraysImplement thelast_gamesmethod below to return the games from the passed index to the end of the list. Try usingArray#fromto return all games sta... 阅读全文
posted @ 2014-09-26 20:48 Zhentiw 编辑
摘要:Collection ClassManaging our game library is getting a little difficult with all of these game instances floating around. Let's create a newLibrarycla... 阅读全文
posted @ 2014-09-26 20:07 Zhentiw 编辑
摘要:LINE ENDINGS IYour company just hired a new developer who works on a Windows computer, and you notice that some files seem to be missing line separato... 阅读全文
posted @ 2014-09-26 15:24 Zhentiw 编辑
摘要:REPO COPYNow you've done it. You accidentally put the company's master password into one of your files. You're beginning to panic because you know tha... 阅读全文
posted @ 2014-09-26 04:21 Zhentiw 编辑
摘要:ROUTES BE RAKINPlease type therakecommand you use to list out all the routes on the command line.rake routesFORMSCreate the form for entering tweet st... 阅读全文
posted @ 2014-09-25 16:08 Zhentiw 编辑
摘要:GIT STASHYou're not quite ready to commit what you're working on, but need to make a quick fix to master. Fear not, juststashyour current changes so y... 阅读全文
posted @ 2014-09-23 22:04 Zhentiw 编辑
摘要:Responsive Images:Responsive image means images which display on our website will adjust its width and height automaticlly according to different scre... 阅读全文
posted @ 2014-09-23 19:31 Zhentiw 编辑
摘要:MAX-WIDTHSet themax-widthofimagesto100%.img{ max-width: 100%;}MAX-WIDTH ON ASSETSSet themax-widthofimages,embeds,objects, andvideosto100%.img,embed... 阅读全文
posted @ 2014-09-22 14:16 Zhentiw 编辑
摘要:FIND THE BREAKPOINTUsing the border handles on either side, keep resizing the site below to see where the logo breaks. Once you find it, write amedia ... 阅读全文
posted @ 2014-09-22 00:57 Zhentiw 编辑
摘要:IPHONE MEDIA QUERYWe want to target a mobile device, specifically an iPhone. Write amedia queryto target the iPhone's320pxwidth, using themax-widthpro... 阅读全文
posted @ 2014-09-21 22:34 Zhentiw 编辑
摘要:REBASE RECAPSo you've been working on your feature branch for a couple days and you realize you need to bring commits back in from master. Now you cou... 阅读全文
posted @ 2014-09-21 17:06 Zhentiw 编辑
摘要:SCOPES IWrite a scope on theTweetmodel calledrecentwhich returns the 4 most recent tweets. Hint: You'll need an order AND a limit scope.#schema.rbActi... 阅读全文
posted @ 2014-09-20 19:08 Zhentiw 编辑
摘要:RAILS NEWEnter the command to start a new rails app called 'ZombieTweets'.rails new ZombieTweetsGENERATE SCAFFOLDEnter the command to create tweet sca... 阅读全文
posted @ 2014-09-20 01:40 Zhentiw 编辑
摘要:Optional ArgumentsWe'll store a little more information about our games than just the name. Optional arguments are important for a flexible interface.... 阅读全文
posted @ 2014-09-20 00:51 Zhentiw 编辑
摘要:1. Clone the angular-seed from git.git clone https://github.com/angular/angular-seed.git2. cd to the angular-seed and type:npm install3. type npm star... 阅读全文
posted @ 2014-09-19 20:54 Zhentiw 编辑
摘要:1. Install Ruby:http://rubyinstaller.org/2. Install Rails:http://railsinstaller.org/en3. Open RubyMine, using cmd to create a new project called "soup... 阅读全文
posted @ 2014-09-19 03:07 Zhentiw 编辑
摘要:SET WIDTH OF SIDEBARUsingpercentages, set thewidthfor the.sidebarto the equivalent of400pxto 6 decimals. Remember, the context is the total width of t... 阅读全文
posted @ 2014-09-18 16:46 Zhentiw 编辑
摘要:NESTED MEDIA QUERIESOur stylesheet contains a responsive breakpoint with some alterations to.factory. Let's clean up the media query a bit by nesting ... 阅读全文
posted @ 2014-09-17 21:12 Zhentiw 编辑
摘要:ARITHMETIC ITo ensure consistent spacing between columns, our stylesheet has a reusable$guttervariable. Subtract the width values in.factoryand.highri... 阅读全文
posted @ 2014-09-17 20:43 Zhentiw 编辑
摘要:FUNCTIONSWe need to find the height of video containers given a width and a 16:9 aspect ratio. To avoid doing the math manually each time, create a fu... 阅读全文
posted @ 2014-09-17 17:20 Zhentiw 编辑
摘要:The link:https://www.firebase.com/docs/android/quickstart.html 阅读全文
posted @ 2014-09-17 05:04 Zhentiw 编辑
摘要:1.Installing Firebase 2.Accessing DataYou'll need areferenceto access data inside your Firebase.A core concept of Firebase is thatevery pie... 阅读全文
posted @ 2014-09-17 05:01 Zhentiw 编辑
摘要:MOBILE WEB DEMOSet thebodyfont-sizeusing relative sizing so that 1em = 10px. Remember, the default font-size for a browser is 16px.body {font-size: 62... 阅读全文
posted @ 2014-09-17 02:21 Zhentiw 编辑
摘要:Better use @extend with % placeholder.Extend is useful when you want to reuse some of you class. Always use % placeholder.EXTEND IIt looks like.bluepr... 阅读全文
posted @ 2014-09-17 01:46 Zhentiw 编辑
摘要:When to use MIXIN?Better way to use MIXIN is when you deal with browser prefiex, for example:@mixin transition($val...){ -webkit-transition: $val; ... 阅读全文
posted @ 2014-09-17 01:21 Zhentiw 编辑
摘要:Variable Declaration +Use$base: #777777; /*Define a variable name*/.sidebar{ border:1px solid $base; p { color: $base; }}Default flag:... 阅读全文
posted @ 2014-09-16 22:04 Zhentiw 编辑
摘要:Unless to replace if !..?Unless可以理解为"除了"if ! tweets.empty? puts "Timeline:" puts tweetsend//Unless is more intuitiveunless tweets.empty? puts "Ti... 阅读全文
posted @ 2014-09-16 20:14 Zhentiw 编辑
摘要:UnlessWe're putting together a system to manage our vast video game collection that we just can't seem to part with. Usingifwith negative conditions c... 阅读全文
posted @ 2014-09-16 20:04 Zhentiw 编辑
摘要:RESOURCE ROUTEconfig/routes.rbCreate aresourcesroute forzombies.TwitterForZombies::Application.routes.draw do resources :zombiesendROUTE MATCHINGCrea... 阅读全文
posted @ 2014-09-16 16:23 Zhentiw 编辑
摘要:Comments://There comments will not be output to the compiled css file/*This comment will*/@Import:The css @import rule has been avoided: prevents para... 阅读全文
posted @ 2014-09-15 16:36 Zhentiw 编辑
摘要:[Rails Level 1] VIEWSSyntax: //execute code //print out the resultDir Hierarchy:app ---views ---layouts --- application.html.erb // T... 阅读全文
posted @ 2014-09-15 15:38 Zhentiw 编辑
摘要:#Resetting the Stage:git reset octofamily/octodog.txt#Undo#git reset did a great job of unstaging octodog.txt, but you'll notice that he's still #ther... 阅读全文
posted @ 2014-09-15 04:53 Zhentiw 编辑
摘要:VARIABLESThe color hex value#797979has been popping up quite a bit throughout our stylesheet. Let's store the color in a variable and replace all inst... 阅读全文
posted @ 2014-09-15 04:28 Zhentiw 编辑
摘要:SHOW ACTIONapp/controllers/zombies_controller.rbCreate theshowaction for the ZombiesController which finds aZombiebased onparams[:id]. Store theZombie... 阅读全文
posted @ 2014-09-15 03:59 Zhentiw 编辑
摘要:Read More:1. https://egghead.io/lessons/angularjs-file-uploads2. https://github.com/danialfarid/angular-file-uploadCan just use npm to install the pac... 阅读全文
posted @ 2014-09-15 02:48 Zhentiw 编辑
摘要:When you want to show both the data and the struatrue:You can create a debug directive: terminal: true --- This means other somthings will be stops. ... 阅读全文
posted @ 2014-09-15 01:01 Zhentiw 编辑
摘要:搭建一个PHP的MVC项目,主要思想是Controller, 调用Model来获取数据,然后把获取到的数据交给View来显示。 $user = $this->model('User'); $user->name = $name; $this-... 阅读全文
posted @ 2014-09-13 14:49 Zhentiw 编辑
摘要:The returned resource object has action methods which provide high-level behaviors without the need to interact with the low level$httpservice.也就是说当用用... 阅读全文
posted @ 2014-09-13 14:35 Zhentiw 编辑
摘要:COMMENTS IWith the addition of Sass to our project, we know.surveyor h2and.surveyor h2 acan be simplified with nesting, but we don't have the time to ... 阅读全文
posted @ 2014-09-12 16:42 Zhentiw 编辑
摘要:VIEWS SIMPLEapp/views/zombies/show.html.erbPrint out thezombie'snameandgraveyard. LINKINGapp/views/zombies/show.html.erbLink to thezombie's show page... 阅读全文
posted @ 2014-09-11 06:12 Zhentiw 编辑
摘要:1. Model in Rails:The reason that you use Tweet then you can find the table tweets is because:There is a class call Tweet which extends Activerecord::... 阅读全文
posted @ 2014-09-11 05:28 Zhentiw 编辑
摘要:1. Go to the git to create a new repository:2. Add some ignore file / dir into .gitign.idea // Webstrom setting files dir3. Then open the webstrom lo... 阅读全文
posted @ 2014-09-11 03:41 Zhentiw 编辑
摘要:CREATE MODELDefine aZombiemodel.class Zombie < ActiveRecord::BaseendVALIDATIONS IAdd a validation that checks for the presence of aZombie's nameclass ... 阅读全文
posted @ 2014-09-10 04:04 Zhentiw 编辑
摘要:Accessing tables:If you have a table: 'tweets' (Lowercase & Plural Table Name).Outside you can access the table byt = Tweet.find(3)It should be Singul... 阅读全文
posted @ 2014-09-10 02:14 Zhentiw 编辑
摘要:class BlogEntry attr_acces­sor :title, :fulltext, :moodendentry = BlogEntry.newentry.title = "Today Mt. Hood was stolen!"entry.time = Time.nowentry.... 阅读全文
posted @ 2014-09-10 01:38 Zhentiw 编辑
摘要:npm install mongoose --save-devnpm install express --save-devbower install angularnpm install cors --save-devnpm install body-parser --save-devindex.h... 阅读全文
posted @ 2014-09-09 21:31 Zhentiw 编辑
只有注册用户登录后才能阅读该文。
posted @ 2014-09-09 21:24 Zhentiw 编辑
摘要:React Hello World Read More:http://facebook.github.io/react/docs/getting-started.html /** @jsx React.DOM */This is a must to include in... 阅读全文
posted @ 2014-09-09 05:12 Zhentiw 编辑
摘要:React Hello World Read More:http://facebook.github.io/react/docs/getting-started.html 阅读全文
posted @ 2014-09-09 05:05 Zhentiw 编辑
摘要:1. Tab --> Auto complateEX: div.button + tab -->2. Ctrl + Shift + Alt + J --> Change mutli lines3. Add shortCut keyFile-->Settings-->Live Template-->F... 阅读全文
posted @ 2014-09-08 17:05 Zhentiw 编辑
摘要:digest only work on the current scope, has no affect on the parent scope!apply works for all the parents scope and current scope!So, if you click dige... 阅读全文
posted @ 2014-09-06 22:13 Zhentiw 编辑
摘要:1. To get a Zombie where id = 1:Zombie.find(1)2. To get Zombie id = 1,2,3, using one line commend:Zombie.find(1,2,3)3. Create a new Zombie: create com... 阅读全文
posted @ 2014-09-06 18:42 Zhentiw 编辑
摘要:transform is used to format json or whatever return from the server.Usage:Profile.factories = angular.module("profileFactories", []);Profile.factories... 阅读全文
posted @ 2014-09-06 17:51 Zhentiw 编辑
摘要:angular.module( "FlightDemo", [ "FlightServices" ]) .controller( "flightDashboard", FlighDashboard);(function (angular) { "use stric... 阅读全文
posted @ 2014-09-05 04:41 Zhentiw 编辑
摘要:When a multi task is run, Grunt looks for a property of the same name in the Grunt configuration. Multi-tasks can have multiple configurations, define... 阅读全文
posted @ 2014-09-04 18:42 Zhentiw 编辑
摘要:After we installed the node.js, we run the cmd:npm installWhat happened is that, we get bower, karma,protractor andhttp-server module.check here:C:\my... 阅读全文
posted @ 2014-09-04 05:13 Zhentiw 编辑
摘要:Chaining multiple asynchronous (server-) callsImagine having a user id in you application. Now you want to load the details of the staff associated wi... 阅读全文
posted @ 2014-09-04 05:10 Zhentiw 编辑
摘要:Chaining promisesThe return value of the then function of the promise is again a promise.(That maybe why in chain promise we can skip new a defer prom... 阅读全文
posted @ 2014-09-04 05:05 Zhentiw 编辑
摘要:The deferred object has a property promise which represents the promise of this task. With this promise we can register an on success and an on failur... 阅读全文
posted @ 2014-09-04 04:57 Zhentiw 编辑
摘要:Using 'wget' can download the website.By default it will download to the current locaiton.Normally, we want to custom the download location and downlo... 阅读全文
posted @ 2014-09-03 21:01 Zhentiw 编辑
摘要:all(promises);Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.defer: 推迟做某事defer.promise.... 阅读全文
posted @ 2014-09-03 17:05 Zhentiw 编辑
摘要:Angular Scope & body{ padding-top: 50px; padding-lleft: 100px;}.bar{ display: inline-block; width: 20px; height:... 阅读全文
posted @ 2014-09-03 15:46 Zhentiw 编辑
摘要:IF(expr1,expr2,expr3)Ifexpr1isTRUE(expr1 0andexpr1 NULL) thenIF()returnsexpr2; otherwise it returnsexpr3.IF()returns a numeric or string value, depend... 阅读全文
posted @ 2014-09-03 04:33 Zhentiw 编辑
摘要:Full-text searching is performed usingMATCH() ... AGAINSTsyntax.MATCH()takes a comma-separated list that names the columns to be searched.AGAINSTtakes... 阅读全文
posted @ 2014-09-03 04:27 Zhentiw 编辑
摘要:mysql> INSERT INTO articles (title,body) VALUES -> ('MySQL Tutorial','DBMS stands for DataBase ...'), -> ('How To Use MySQL Well','After you wen... 阅读全文
posted @ 2014-09-03 04:11 Zhentiw 编辑
摘要:app.controller("AppCtrl",function(){ this.message = "hello";}) describe("Hello Controller",function(){ var appCtrl; var $controlle... 阅读全文
posted @ 2014-09-02 21:27 Zhentiw 编辑
摘要:Usually, when we do testing, we inject $compile, $rootScope into the beforeEach funciton();Actually, there is a goodpratice that we write _$compile_, ... 阅读全文
posted @ 2014-09-02 21:12 Zhentiw 编辑
摘要:在测试文件中使用的scope是inject进去的,所以使用scope.clicked也可以找到原来directive定义的scope.但是如果在driectvie中使用了isolated scope:app.directive('testDir',function(){ return{ ... 阅读全文
posted @ 2014-09-02 21:03 Zhentiw 编辑
摘要:describe("Hello world",function(){ var element; var $scope; beforeEach(module("app")) beforeEach(inject(function($compile, $rootScope){ ... 阅读全文
posted @ 2014-09-02 03:02 Zhentiw 编辑
摘要:If wants to use karma with AngualrJS, we need to include angular.min-js and angular-mocks.js inside karma.config.jsBe careful with the order, angular.... 阅读全文
posted @ 2014-09-02 02:49 Zhentiw 编辑
摘要:/** * Created by Answer1215 on 9/1/2014. */module.exports = function(grunt){ grunt.initConfig({ person: { "firstName": "Zhentian"... 阅读全文
posted @ 2014-09-01 18:28 Zhentiw 编辑
摘要:1. Using cmd to type:npm install -g grunt-clinpm install grunt2. Create a GruntFile.js in the project dir.3. Write code into the grunt file:/** * Crea... 阅读全文
posted @ 2014-09-01 18:20 Zhentiw 编辑
摘要:What is Unit Testing:Unit tests try to answer questions such as "Did I think about the logic correctly?" or "Does the sort funciton order the list in ... 阅读全文
posted @ 2014-09-01 17:58 Zhentiw 编辑

点击右上角即可分享
微信分享提示