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 toggler(dom_element) { | |
| var inner = dom_element.innerHTML; | |
| var new_inner; | |
| if (inner.indexOf('Show') !== -1) { | |
| new_inner = inner.split('Show').join('Hide'); | |
| } else if (inner.indexOf('show') !== -1) { | |
| new_inner = inner.split('show').join('hide'); | |
| } else if (inner.indexOf('hide') !== -1) { | |
| new_inner = inner.split('hide').join('show'); |
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
| _oMyController.setListener('firstEvent secondEvent', function(data) { | |
| if (data.is_second_event) { | |
| // do something specific just to the second event | |
| } | |
| // do something common to both events | |
| }); |
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
| <select id="sel1"> | |
| <option>Eric</option> | |
| <option>Joe</option> | |
| </select> | |
| <p id="eric" class="hidden">Hi, I'm eric</p> | |
| <p id="joe" class="hidden">Hi, I'm joe</p> | |
| $(document).ready(function(){ |
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
| public static function indentJSON($json) { | |
| $result = ''; | |
| $pos = 0; | |
| $strLen = strlen($json); | |
| //$indentStr = ' '; | |
| //$newLine = "\n"; | |
| $indentStr = ' '; | |
| $newLine = "<br/>"; | |
| for($i = 0; $i <= $strLen; $i++) { $char = substr($json, $i, 1); if($char == '}' || $char == ']') { $result .= $newLine; $pos --; for ($j=0; $j<$pos; $j++) { $result .= $indentStr; } } $result .= $char; if ($char == ',' || $char == '{' || $char == '[') { $result .= $newLine; if ($char == '{' || $char == '[') { $pos ++; } for ($j = 0; $j < $pos; $j++) { $result .= $indentStr; } } } return $result; |
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
| PUT AS TWO SEPARATE SCRIPTS: store.sh, and store.py. | |
| USAGE: ./store.sh | |
| #/!bin/bash | |
| echo "Wait...." | |
| history > /tmp/store | |
| /home/jhuttner/store.py | |
| cat /tmp/store2 | pbcopy |
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/bash | |
| ssh local pbcopy - |
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
| #!/usr/local/bin/python | |
| # If you have an n-core machine, open n terminals and run this script in each one. | |
| def fib(n): | |
| if n == 1 or n == 0: | |
| return 1 | |
| else: | |
| return fib(n-1) + fib(n-2) |
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/bash | |
| CNT=`ps -ef | grep -e Network | grep -v grep | wc -l` | |
| if [ $CNT -eq 1 ]; then | |
| kill `ps -ef | grep -e Network | grep -v grep | awk '{print $2}'` | |
| fi | |
| /Applications/Network\ Connect.app/Contents/MacOS/Network\ Connect & |
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 unbind = function($tab, by_type) { | |
| /* | |
| * var types = { | |
| * 'click': ['#selector_one', '#selector_two'], | |
| * 'delegate': ['#selector_three'], | |
| * 'live': ['#selector_four'] | |
| * } | |
| * unbind($geoTab, types); | |
| */ | |
| for (var i in by_type) { |
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
| [color "diff"] | |
| meta = yellow bold | |
| frag = magenta bold | |
| old = red bold | |
| new = blue bold |