This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git svn clone <repo_url> [name] | |
| git svn rebase | |
| git svn dcommit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage: log('inside coolFunc',this,arguments); | |
| // http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
| window.log = function(){ | |
| log.history = log.history || []; // store logs to an array for reference | |
| log.history.push(arguments); | |
| if(this.console){ | |
| console.log( arguments ); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage: log('inside coolFunc',this,arguments); | |
| // http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
| window.log = function(){ | |
| log.history = log.history || []; // store logs to an array for reference | |
| log.history.push(arguments); | |
| if(this.console){ | |
| console.log( Array.prototype.slice.call(arguments) ); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def last_commit_message | |
| output = parsed_json(list_commits) | |
| output["commits"] ? output["commits"][0]["message"] : output | |
| end | |
| def last_commit_date | |
| output = parsed_json(list_commits) | |
| output["commits"] ? DateTime.parse(output["commits"][0]["committed_date"]).strftime("%d %B %Y %I:%M%p") : output | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def last_commit_message | |
| with_commits_list { |o| o["commits"] ? o["commits"][0]["message"] : o } | |
| end | |
| def last_commit_date | |
| with_commits_list do |o| | |
| o["commits"] ? DateTime.parse(o["commits"][0]["committed_date"]).strftime("%d %B %Y %I:%M%p") : o | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var person = function(spec){ | |
| var that = {}; | |
| that.getName = function(){ | |
| return spec.name; | |
| }; | |
| that.getSex = function(){ | |
| return spec.sex; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Based on Crockford's Private Members in JavaScript post.. | |
| var myObject = { | |
| name : "Edmore", | |
| age : 28, | |
| next_year : function(){ // method | |
| return this.age += 1; | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def make_a_sound(obj) | |
| obj.sound! | |
| end | |
| def catch_make_a_sound(obj) | |
| return obj.sound! if obj.respond_to? sound! | |
| "#{obj.name} does not make a sound!!" | |
| end | |
| class Mouse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage : mult2 = multiplier(2) ; mult2(3) gives you 6 | |
| // usage : mult3 = multiplier(3) | |
| var multiplier = function(x){ | |
| return function(y){ | |
| return x * y; | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def multiplier(x) | |
| lambda { |n| x * n } | |
| end | |
| # mult2 = multiplier(2) # returns Proc object | |
| # mult2.call(3) # 6 |