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
// 1: how could you rewrite the following to make it shorter? | |
bar['doSomething' + (foo ? '' : 'Else')](el); | |
// 2: what is the faulty logic in the following code? | |
// It will always print "world" to the console because foo is undefined in the | |
// anonymous function's closure at the time of the shortcut attempt. |
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
/* | |
* Copyright (c) 2010 Jason Wyatt Feinstein | |
* | |
* Permission is hereby granted, free of charge, to any person | |
* obtaining a copy of this software and associated documentation | |
* files (the "Software"), to deal in the Software without | |
* restriction, including without limitation the rights to use, | |
* copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the | |
* Software is furnished to do so, subject to the following |
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
#!/opt/local/bin/ruby -w | |
################################################ | |
# Settings | |
################################################ | |
# Directory to watch | |
watch_location = "." | |
# Pattern for files to watch | |
watch_pattern = "**/*" #all files/subdirectories |
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
/** | |
* Permanently bind a function to an object. | |
* | |
* @param fn (function) | |
* Function to bind. | |
* @param object (object) | |
* Object scope to force the function to run within. | |
* @return | |
* New function, where the argument function is forced to | |
* execute within the scope of object. |
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
/** | |
* Overwrites the old alert method and chooses to use console.log instead (if it's | |
* available). | |
* Author: Jason Feinstein | |
*/ | |
var oldAlert = alert; | |
alert = function(){ | |
if(window.console != null){ | |
console.log.apply(null, arguments); | |
} else { |
NewerOlder