A Pen by Shai Aharoni on CodePen.
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 list = document.getElementById("list"); | |
for (var i = 1; i <= 5; i++) { | |
var item = document.createElement("LI"); | |
item.appendChild(document.createTextNode("Item " + i)); | |
let j = i; | |
item.onclick = function (ev) { | |
console.log("Item " + j + " is clicked."); | |
}; |
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
public class TemplateParser | |
{ | |
public string ParseTemplate(string template, object data) | |
{ | |
var tokensRegex = new Regex(@"\{{([^}]+)}}"); | |
return tokensRegex.Replace(template, match => | |
{ | |
string tokenName = match.Groups[1].Value; |
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
<script> | |
var AFreq = 440; | |
var CFreq = 261.626; | |
var EFreq = 329.628; | |
var audioContext = new AudioContext(); | |
var gainMix = audioContext.createGain(); | |
gainMix.gain.value = 0.1; |
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
<script> | |
var audioContext = new AudioContext(); | |
var osc = audioContext.createOscillator(); | |
var osc2 = audioContext.createOscillator(); | |
var gainOsc = audioContext.createGain(); | |
var gainOsc2 = audioContext.createGain(); | |
var gainMix = audioContext.createGain(); | |
gainOsc.gain.value = 0.1; |
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 getCurrentDirEntriesMock = function (onSuccess) { | |
var entries = []; | |
if (currentDir.name == "rootDirectory") { | |
entries.push({ isDirectory: true, name: "dir1" }); | |
entries.push({ isDirectory: true, name: "dir2" }); | |
entries.push({ isFile: true, name: "file1" }); | |
entries.push({ isFile: true, name: "file2" }); |
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
USE DBNAME ; | |
GO | |
EXEC sp_configure 'remote query timeout', 1000 /*Num of seconds*/ ; | |
GO | |
RECONFIGURE ; | |
GO |
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
//For simulating PhoneGup | |
M.PhoneGap = {}; | |
//getImage | |
M.PhoneGap.getImage = function (callback) { | |
callback("someImage" + (new Date()).getMilliseconds() + ".jpg"); | |
}; | |
//mapFileName |
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
//Phone number regex | |
//A simple match for up to 10 digits or {2-3}-{6-7} | |
var simplePnoneRegex = new Regex(@"^\d{2,3}(-)?\d{6,7}$"); |
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 drawZoomButtons() { | |
for (var i = 1; i <= numOfTicks; i++) { | |
var position = (canvas.width / numOfTicks) * i; | |
(function (sectionNum) { | |
var zoomInBtn = $("<div>") | |
.addClass("timelineZoomInButton") |
NewerOlder