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
jQuery(function($) { | |
function validatePrerequisites() { | |
// <select /> DOM ID to item label map | |
var selectDOMIdToLabelMap = { | |
"free-t-shirt-size": "Free T Shirt Size", | |
"power-protein-flavor": "Power Protein Flavor", | |
"pump-powder": "Pump Powder" | |
}; |
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
// see http://static-content-01.s3-website-us-east-1.amazonaws.com/Promise_promisifyAll___bluebird_1CEF7997.png | |
// catalist was to solve for promisifying cordova plugins and it's non-[standard|node] callback convention (successFn, errorFn) vs node's fn(error, success) | |
var Runner = function() { | |
return this; | |
}; | |
Runner.prototype.echo = function(msg, success, failure){ | |
success(msg); | |
}; |
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
// Promise series example | |
function task(name) { | |
return new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
console.log(name, new Date()); | |
if (name === 'fail') { | |
reject(name); | |
} else { | |
resolve(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
{ | |
"id": "8d98e250-5e11-11e5-8d11-8912d003bf4f", | |
"complete": true, | |
"operation": "open-project", | |
"error": "Cannot read property 'path' of undefined", | |
"stack": "TypeError: Cannot read property 'path' of undefined\n at /Applications/MavensMate.app/Contents/Resources/app/node_modules/mavensmate/lib/mavensmate/commands/project/open-project.js:36:40\n at tryCatch2 (/Applications/MavensMate.app/Contents/Resources/app/node_modules/mavensmate/node_modules/bluebird/js/main/util.js:53:21)\n at Promise._resolveFromResolver (/Applications/MavensMate.app/Contents/Resources/app/node_modules/mavensmate/node_modules/bluebird/js/main/promise.js:544:13)\n at new Promise (/Applications/MavensMate.app/Contents/Resources/app/node_modules/mavensmate/node_modules/bluebird/js/main/promise.js:82:37)\n at Command.execute (/Applications/MavensMate.app/Contents/Resources/app/node_modules/mavensmate/lib/mavensmate/commands/project/open-project.js:25:10)\n at /Applications/MavensMate.app/Contents/Resources/app/no |
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 NonMatchedAccountExporter { | |
public void run(List_MRK__c listID) { | |
Boolean moreToProcess = execute(listID); | |
while(moreToProcess = true) { | |
moreToProcess = execute(listID); | |
} | |
} | |
public Boolean execute(List_MRK__c listID) { |
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
import AudioToolbox | |
func loadAndPlaySounds() { | |
var path = NSBundle.mainBundle().bundlePath.stringByAppendingPathComponent("sounds") | |
if let fileNames = NSFileManager.defaultManager().contentsOfDirectoryAtPath(path, error: nil) as? [String] { | |
for fileName in fileNames { | |
var filePath = path.stringByAppendingPathComponent(fileName) | |
println("filePath = \(filePath)") |
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 os = require('os'); | |
var methodNames = []; | |
for (var prop in os) { | |
if ( os.hasOwnProperty(prop) && typeof os[prop] === 'function') { | |
methodNames.push(prop) | |
} | |
} |
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
<?php | |
$loggedin = false; | |
$error = false; | |
session_start(); | |
if ($_SERVER['REQUEST_METHOD'] == 'POST') { | |
$userName=addslashes($_POST['userName']); | |
$userPwd=addslashes($_POST['userPwd']); | |
$sql="SELECT * FROM users WHERE userName='$userName' and userPwd='$userPwd'"; | |
$result=mysql_query($sql); |
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
import random | |
def main(): | |
# create array of 500 elements | |
nums=[0]*500 | |
# populate each array element with a random int from 0-100 | |
for i in range(len(nums)): | |
nums[i]=random.randint(0, 100) | |
total=getTotal(nums) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Default</key> | |
<dict> | |
<key>_name</key> | |
<string>Default</string> | |
<key>alertView</key> | |
<dict> |