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
''' | |
Add CORS headers for tastypie APIs | |
Usage: | |
class MyModelResource(CORSModelResource): | |
... | |
class MyResource(CORSResource): | |
... | |
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
// Pre-requisites: | |
// 1. Device core plugin | |
// 2. Splashscreen core plugin (3.1.0) | |
// 3. config.xml: <preference name="AutoHideSplashScreen" value="false" /> | |
// 4. config.xml: <preference name="DisallowOverscroll" value="true" /> | |
function onDeviceReady() { | |
if (parseFloat(window.device.version) >= 7.0) { | |
document.body.style.marginTop = "20px"; | |
// OR do whatever layout you need here, to expand a navigation bar etc |
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
/* | |
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16 | |
2013-09-29 21:23:26.469 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 0 | |
2013-09-29 21:23:26.471 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type steps 0 | |
2013-09-29 21:23:26.472 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type walking steps 0 | |
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0 | |
2013-09-29 21:23:26.475 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 341 | |
2013-09-29 21:23:26.476 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence high type walking steps 6 | |
2013-09-29 21:23:26.478 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence low type steps 18 | |
2013-09-29 21:23:26.480 perf[3911:60b] Sep 26, 2013, 9:05 AM confidence low type steps 6 |
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
'use strict'; | |
angular.module('JobNavsApp') | |
.factory('LoadingService', function ($rootScope) { | |
NProgress.configure({ | |
trickleRate: 0.35, | |
trickleSpeed: 700 | |
}); |
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
# This script uses Evernote's API to create a new template note to be used in meetings. | |
# The template includes the following fields: Date, Time, Attendance, Objective, Remarks and | |
# Action Items. The fields are shown using Evernote Markup Language. It also automatically | |
# adds the the date when the note was created at the end of the note's title. | |
# | |
# When run, it lists all notebooks in a user's account (just as reference), then | |
# asks for the title of the new note (automatically adding the current date at the | |
# end in ISO format YYYY-MM-DD), then asks for the tags to be assigned to the note and | |
# creates it in a pre-defined notebook (hard coded in the ntbkName variable below). | |
# |
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
# -*- coding: utf-8 -*- | |
import scene | |
keyboard_layouts = ( | |
''' | |
q w e r t y u i o p del | |
a s d f g h j k l return | |
z x c v b n m , . shift | |
.?123 space .?123 |
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
Unicode table - List of most common Unicode characters * | |
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable. | |
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol. | |
What is Unicode? | |
Unicode is a standard created to define letters of all languages and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode. | |
How to identify the Unicode number for a character? | |
Type or paste a character: |
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 | |
/* | |
Backup script for trakt.tv (API v2). | |
Live demo: https://darekkay.com/blog/trakt-tv-backup/ | |
*/ | |
// create a Trakt app to get a client API key: http://docs.trakt.apiary.io/#introduction/create-an-app | |
$apikey = "CLIENT_API_KEY"; |
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
# get it | |
docker pull mongo | |
# startup a 3 node replica set | |
docker run --name mongo-rs-1 -d mongo --nojournal --oplogSize 10 --replSet rs | |
docker run --name mongo-rs-2 -d mongo --nojournal --oplogSize 10 --replSet rs | |
docker run --name mongo-rs-3 -d mongo --nojournal --oplogSize 10 --replSet rs | |
# connect to first node | |
docker run -it --link mongo-rs-1:mongo1 --link mongo-rs-2:mongo2 --link mongo-rs-3:mongo3 --rm mongo /bin/bash |
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
extension NSURL { | |
func getKeyVals() -> Dictionary<String, String>? { | |
var results = [String:String]() | |
var keyValues = self.query?.componentsSeparatedByString("&") | |
if keyValues?.count > 0 { | |
for pair in keyValues! { | |
let kv = pair.componentsSeparatedByString("=") | |
if kv.count > 1 { | |
results.updateValue(kv[1], forKey: kv[0]) | |
} |