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
| escape - completion of words in the current document | |
| ⌘/ - comment selection/line with line comments | |
| ⌘⌥/ - comment selection/line with block comment | |
| command option . - close current HTML/XML tag | |
| command-shift-l - select current line | |
| command-option-a - edit all selected rows | |
| command-option-return - insert terminator at end of line | |
| command-shift-t - select file by name / focus project search | |
| command-ctrl-t - select command/snippet by name |
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 Dictionary = new Native({ | |
| name: 'Dictionary', | |
| initialize: function(){ | |
| this.keys = []; | |
| this.values = []; | |
| } | |
| }); |
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
| Element.implement({ | |
| matchFromRoot: function(selector){ | |
| return document.getElements(selector, true).contains(this); | |
| } | |
| }); | |
| myElement.match('div') // true | |
| myElement.match('body div') // false | |
| myElement.matchFromRoot('div') // true |
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
| #!/bin/sh | |
| # | |
| # This hook does two things: | |
| # | |
| # 1. update the "info" files that allow the list of references to be | |
| # queries over dumb transports such as http | |
| # | |
| # 2. if this repository looks like it is a non-bare repository, and | |
| # the checked-out branch is pushed to, then update the working copy. | |
| # This makes "push" function somewhat similarly to darcs and bzr. |
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
| (?x-m)^ | |
| # Yes *+ Open ( Blank |Comments | (No Paren | String) | String | (Nested Parens ) )*+ | |
| (?> \g<yesS>*+ \[ (?<yesS> (?!.) |//.*+|/\*((?!\*/).)++(\*/|$)|(^)((?!/\*).)*(\*/)| (?<noS>[^\[\]''"/]) | (?<str> ''(\\''|[^''])*+'' | "(\\"|[^"])*+" | /(\\/|[^/])*+/) | (?<squar> \[ \g<yesS>*+ \] ) )*+ | |
| | \g<yesR>*+ \( (?<yesR> (?!.) |//.*+|/\*((?!\*/).)++(\*/|$)|(^)((?!/\*).)*(\*/)| (?<noR>[^\(\)''"/]) | \g<str> | (?<round> \( \g<yesR>*+ \) ) )*+ | |
| | \g<yesC>*+ \{ (?<yesC> (?!.) |//.*+|/\*((?!\*/).)++(\*/|$)|(^)((?!/\*).)*(\*/)| (?<noC>[^\{\}''"/]) | \g<str> | (?<curly> \{ \g<yesC>*+ \} ) )*+ | |
| )$ |
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
| Class.Mutators.Logs=function(self,methods){ | |
| $splat(methods).each(function(methodName){ | |
| var method = self[methodName]; | |
| self[methodName]=function(){ | |
| try{ console.log(Array.flatten([methodName, arguments]).join(',')); }catch(e){}; | |
| return method(arguments); | |
| }; | |
| }); | |
| return self; | |
| }; |
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
| /* | |
| mkdir -p ~/Library/KeyBindings | |
| mv ~/Desktop/DefaultKeyBinding.dict ~/Library/KeyBindings/DefaultKeyBinding.dict #*/ | |
| { | |
| /* Modifier keys: start with C-m */ | |
| "^m" = { | |
| "^ " = ("insertText:", "\U2423"); /* C-space space */ | |
| "^e" = ("insertText:", "\U21A9"); /* C-e return */ | |
| "e" = ("insertText:", "\U2305"); /* e enter */ |
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 pp(object){ | |
| switch ($type(object)){ | |
| case 'object': | |
| object = $H(object); | |
| var h = '{ '; | |
| object.each(function(value, key){ | |
| h += '{key}: {value}, '.substitute({key:key, value: pp(value) }) | |
| }) | |
| h += ' }' |
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
| // TODO: Remove this once it's added to MooTools code | |
| Element.implement({ | |
| toFormHash: function(){ | |
| var formHash = $H(); | |
| this.getElements('input, select, textarea', true).each(function(el){ | |
| if (!el.name || el.disabled) return; | |
| var value = (el.tagName.toLowerCase() == 'select') ? Element.getSelected(el).map(function(opt){ | |
| return opt.value; | |
| }) : ((el.type == 'radio' || el.type == 'checkbox') && !el.checked) ? null : el.value; | |
| $splat(value).each(function(val){ |
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 formatCurrency(num){ | |
| num = (num||'0').toString().replace(/\$|\,/g,''); | |
| if(isNaN(num)) num = "0"; | |
| if(num+0 == 0) return '$0'; | |
| var sign = (num == (num = Math.abs(num))); | |
| num = Math.floor(num*100+0.50000000001); | |
| var cents = num%100; | |
| num = Math.floor(num/100).toString(); |