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
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
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
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
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
// create our web view | |
var win = Ti.UI.createWindow({ backgroundColor: "#fff" }); | |
var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" }); | |
// inject our css when the web view finishes loading (because we need to inject into the head element) | |
web.addEventListener('load', function () { | |
// first, specify the CSS file that we should load | |
var cssFileName = 'styles.css'; | |
// read in the contents | |
var cssFromFile = Ti.Filesystem.getFile(cssFileName); |
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
// I thought I needed it, but I didn't need it anymore, | |
// but I already implemented it. So, here we go, if you | |
// ever would need a Javascript camelize implementation | |
// you can freely use this :-). | |
// - [email protected] Tue Feb 15 16:49:52 CET 2011 | |
jQuery.extend (String.prototype, { | |
camelize: function () { | |
return this.replace (/(?:^|[-_])(\w)/g, function (_, c) { |
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
sys = require "sys"; | |
http = require "http"; | |
url = require "url"; | |
connect = require "connect"; | |
redis = require "redis"; | |
hashRing = require "hash_ring"; | |
Sharding = { | |
servers = { "127.0.0.1 10000 6378": 1 }; | |
ring = new hashRing.HashRing servers; |
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 url = "http://maps.google.com/maps/ms?ie=UTF&msa=0&msid=217110902183005084784.00049d962454fabcabdc2&output=kml"; | |
//Add routes from a remote KML file to one map | |
goog.maps.kml.addRoutesToMap(mySingleMap, url); | |
//Multiple Maps | |
goog.maps.kml.addRoutesToMap([myGoogleMap1, myGoogleMap2], url); |
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
countries = [ | |
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'}, | |
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'}, | |
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"}, | |
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'}, | |
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'}, | |
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'}, | |
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai |
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
//npm install b64url | |
//A signed_request for testing: | |
//WGvK-mUKB_Utg0l8gSPvf6smzacp46977pTtcRx0puE.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyOTI4MjEyMDAsImlzc3VlZF9hdCI6MTI5MjgxNDgyMCwib2F1dGhfdG9rZW4iOiIxNTI1NDk2ODQ3NzczMDJ8Mi5ZV2NxV2k2T0k0U0h4Y2JwTWJRaDdBX18uMzYwMC4xMjkyODIxMjAwLTcyMTU5OTQ3NnxQaDRmb2t6S1IyamozQWlxVldqNXp2cTBmeFEiLCJ1c2VyIjp7ImxvY2FsZSI6ImVuX0dCIiwiY291bnRyeSI6ImF1In0sInVzZXJfaWQiOiI3MjE1OTk0NzYifQ | |
function parse_signed_request(signed_request, secret) { | |
encoded_data = signed_request.split('.',2); | |
// decode the data | |
sig = encoded_data[0]; | |
json = base64url.decode(encoded_data[1]); | |
data = JSON.parse(json); // ERROR Occurs Here! |
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
set selectedDevices to choose from list {"iPhone", "iPhone (Retina)", "iPad"} with prompt "Choose device type:" default items {"iPhone"} without multiple selections allowed | |
if selectedDevices is not false then | |
set selectedDevice to item 1 of selectedDevices as string | |
set thePListFolderPath to path to preferences folder from user domain as string | |
set thePListPath to thePListFolderPath & "com.apple.iphonesimulator.plist" | |
tell application "System Events" | |
tell property list file thePListPath | |
tell contents | |
set value of property list item "SimulateDevice" to selectedDevice |
OlderNewer