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
| // from http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css | |
| input::-webkit-input-placeholder | |
| color: #fff | |
| input:-moz-placeholder | |
| color: #fff |
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
| """ | |
| Look up all Users associated with a particular badge. | |
| """ | |
| import timeit | |
| s = """\ | |
| from profiles.models import Badge, UserProfile | |
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
| /** | |
| * Note: the following function should already exist in your application delegate file. | |
| * Replace it with the following implementation. | |
| * | |
| * Thanks to @purplecabbage for implementation. | |
| */ | |
| // ... | |
| /** |
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
| (function() { | |
| // http://www.nczonline.net/blog/2012/03/13/its-time-to-start-using-javascript-strict-mode/ | |
| "use strict"; | |
| function doSomething() { | |
| // this runs in strict mode | |
| } | |
| function doSomethingElse() { | |
| // so does this |
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
| <style> | |
| /* from http://www.mobilexweb.com/blog/ios-5-1-new-ipad-web-developers */ | |
| @media screen and (-webkit-device-pixel-ratio: 2) { | |
| /* retina display */ | |
| } | |
| </style> | |
| <script> | |
| // from https://developer.mozilla.org/en/DOM/window.matchMedia | |
| if (window.matchMedia("(-webkit-device-pixel-ratio: 2)").matches) { |
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 sys | |
| import traceback | |
| try: | |
| # do something | |
| except: | |
| traceback.print_exc(file=sys.stdout) |
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
| def unique(s): | |
| """Return a list of the elements in s, but without duplicates. | |
| For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], | |
| unique("abcabc") some permutation of ["a", "b", "c"], and | |
| unique(([1, 2], [2, 3], [1, 2])) some permutation of | |
| [[2, 3], [1, 2]]. | |
| For best speed, all sequence elements should be hashable. Then | |
| unique() will usually work in linear time. |
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
| // based on http://blog.jeremymartin.name/2008/02/building-your-first-jquery-plugin-that.html | |
| (function($){ | |
| $.fn.PLUGIN-NAME = function(options) { | |
| var defaults = { | |
| VARIABLE: PARAMETER, | |
| VARIABLE2: PARAMETER | |
| // i.e. minTrail: 20 | |
| }; | |
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
| function createDatabase() { | |
| try { | |
| var shortName = dataConfig.database; | |
| var version = dataConfig.databaseVersion; | |
| var displayName = dataConfig.database; | |
| var maxSize = dataConfig.databaseMaxSize; | |
| db = openDatabase(shortName, version, displayName, maxSize); | |
| db.transaction(function(transaction) { | |
| transaction.executeSql( |
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
| <<toc / 3>> |