This file contains 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
// WARNINGS:: This function is *relatively* untested (i.e. there is no formal testing as of yet). Use at your own risk. | |
// It is normally MUCH better to use setTimeout or requestAnimationFrame than to block in a single-threaded environment, be KIND to your users | |
// This function is best suited to testing the behaviour of an application when intensive processing occurs | |
function sleep(ms){ | |
var initial = +new Date() | |
while(+new Date() < initial + ms){} | |
} |
This file contains 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
{ | |
publishers: {}, | |
fire: function (event) { | |
for (var i = 0; i < this.publishers[this.uid][event].length; i++) { | |
// call each listener's function | |
this.publishers[this.uid][event][i].listener[this.publishers[this.uid][event][i].func](); | |
} | |
}, | |
addListener: function (uid, listener, func, event) { |
This file contains 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 age, foo; | |
age = 99; | |
foo = function() { | |
return age = 0; | |
}; | |
foo(); | |
console.log(age); # => 0 | |
------------------------ |
This file contains 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
// ON the behaviour of 'var'less variable declaration | |
// if you do this: | |
function foo(){ | |
age = 99 | |
} |
This file contains 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
<?php | |
if(isset($_POST['submit1'])) { | |
$var1=$_POST['submit1'] | |
echo "it works1"; | |
} | |
echo " "; | |
if(isset($_POST['submit2'])) { | |
echo "it works2"; | |
} |
This file contains 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
<html> | |
<form action="form.php" method="post"> | |
<input type="submit" id="submit1" name="submit1" value="Click Me1" onclick="document.getElementbyId("submit1").value=itworks1"> | |
<br /> | |
<input type="submit" id="submit2" name="submit2" value="Click Me2" onclick="document.getElementbyId("submit2").value=itworks2"> | |
<br /> | |
<input type="submit" id="submit3" name="submit3" value="Click Me3" onclick="document.getElementbyId("submit3").value=itworks3"> | |
<br /> |
This file contains 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 colorScheme(r, g, b){ | |
return function(callback){ | |
return callback(r, g, b) | |
} | |
} | |
function darken(darken_by){ | |
return function(r, g, b){ |
This file contains 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
... | |
message: function(x){ | |
return "with for loop this would return. " + x; | |
}, | |
calculate: function(){ | |
var _this = this | |
jQuery.each(fees_table, function (i, v) { | |
//console.dir(v); |
This file contains 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
$('#multiple_date_select').multiDatesPicker({ | |
numberOfMonths: 3, | |
dateFormat: 'mm/dd/yy', | |
altField: '#meeting_dates', | |
addDisabledDates: json_data.meeting_dates, | |
minDate: json_data.start_date, | |
maxDate: json_data.end_date | |
}); | |
// want to do this |
This file contains 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 scroll = window.onscroll || function(){} | |
window.onscroll = function(){ | |
scroll() | |
instance.scrolled += 1 | |
} | |
}() |
OlderNewer