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
| (function() { | |
| var CSSCriticalPath = function(w, d, opts) { | |
| var opt = opts || {}; | |
| var css = {}; | |
| var pushCSS = function(r) { | |
| if(!!css[r.selectorText] === false) css[r.selectorText] = {}; | |
| var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/); | |
| for(var i = 0; i < styles.length; i++) { | |
| if(!!styles[i] === false) continue; | |
| var pair = styles[i].split(": "); |
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
| //http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
| Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
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
| // ES6 for loops | |
| // ============= | |
| // Things in ES6 can be "iterable". Arrays are iterable by default. | |
| var fruits = ['Apple', 'Banana', 'Grape']; | |
| for (var fruit of fruits) | |
| console.log('Fruit: ' + fruit); |
This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.
git stash show -p > patch
You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.
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
| // format an ISO date using Moment.js | |
| // http://momentjs.com/ | |
| // moment syntax example: moment(Date("2011-07-18T15:50:52")).format("MMMM YYYY") | |
| // usage: {{dateFormat creation_date format="MMMM YYYY"}} | |
| Handlebars.registerHelper('dateFormat', function(context, block) { | |
| if (window.moment) { | |
| var f = block.hash.format || "MMM DD, YYYY hh:mm:ss A"; | |
| return moment(context).format(f); //had to remove Date(context) | |
| }else{ | |
| return context; // moment plugin not available. return data as is. |
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
| /* | |
| JavaScript Caesar shift | |
| by Evan Hahn (evanhahn.com) | |
| "Encrypt" like this: | |
| caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!" | |
| And "decrypt" like this: |
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
| rails g scaffold Book title:string description:text | |
| rails g scaffold Pubhouse title:string address:text | |
| rails g model BookPubhouse book_id:integer pubhouse_id:integer | |
| rake db:migrate |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Ansi 0 Color</key> | |
| <dict> | |
| <key>Blue Component</key> | |
| <real>0.078821629285812378</real> | |
| <key>Green Component</key> | |
| <real>0.07883714884519577</real> |
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
| namespace.views.MyWizard = Backbone.Views.extend({ | |
| initialize: function() { | |
| _.bindAll(this, 'render', 'wizardMethod'); | |
| } | |
| render: function() { | |
| this.wizardMethod(); | |
| return this; | |
| }, |