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
# | |
# Replaces Backbone.History with support for HTML5 history API if browser supports it. | |
# To use, setup your controllers as usual and try it with a browser that supports the HTML5 history API. | |
# For browsers that don't support the HTML5 API, this will fall back to using the default Backbone hash routing. | |
# | |
# I have only tested this on my project in Firefox, Safari and Chrome so let me know. | |
# | |
pushSupport = window.history? and window.history.pushState? | |
if pushSupport and Backbone? and Backbone.History? | |
rootUrl = document.location.protocol+'//'+(document.location.host or document.location.hostname) |
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
#=require haml | |
#=require backbone | |
class PageView extends Backbone.View | |
tag: "div" | |
class: "page" | |
classes: -> | |
[] |
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
#!/bin/sh | |
exec scala -savecompiled "$0" "$@" | |
!# | |
import java.io._ | |
val docs = new File(".").listFiles | |
.filter(_.getName.endsWith(".textile")) // process only textile files | |
.map(new DocumentationFile(_)) |
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
+ (NSDictionary *)downloadableFonts | |
{ | |
CTFontDescriptorRef desc = CTFontDescriptorCreateWithAttributes((CFDictionaryRef)@{(id)kCTFontDownloadableAttribute : (id)kCFBooleanTrue}); | |
CFArrayRef matchedDescs = CTFontDescriptorCreateMatchingFontDescriptors(desc, NULL); | |
NSArray *array = (__bridge NSArray *)matchedDescs; | |
NSMutableDictionary *families = [NSMutableDictionary dictionary]; | |
for (UIFontDescriptor *fontDescriptor in array) { | |
NSString *familyName = fontDescriptor.fontAttributes[UIFontDescriptorFamilyAttribute]; |
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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: logstash | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time | |
# Description: Enable service provided by daemon. | |
### END INIT INFO |
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
import Dispatch | |
/// Dispatch options for `forEach` loops | |
public enum ForEachClosureDispatch { | |
case sequential | |
case concurrent | |
} | |
extension Sequence { | |
/// Calls the given closure on each element in the sequence in the same order |
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
# ## Backbone model caching | |
# This is a simple solution to the problem "how do I make less requests to | |
# my server?". | |
# | |
# Whenever you need a model instance, this will check first if the same thing | |
# has been fetched before, and gives you the same instance instead of fetching | |
# the same data from the server again. | |
# | |
# Reusing the same instance also has the great side-effect of making your | |
# model changeable from one part of your code, with your changes being available |
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
import UIKit | |
import PlaygroundSupport | |
// https://gist.github.com/erica/6f13f3043a330359c035e7660f3fe7f5 | |
// Original Video: https://www.youtube.com/watch?v=TTmWUSgNOHk | |
// Video: https://www.youtube.com/watch?v=hmAB3WJOQTU | |
// Video: https://www.youtube.com/watch?v=DWtavuvmKdw (with zoom and fade) | |
// String to animate and its attributes | |
var string = "Hello, playground" | |
let attributes: [String: Any] = [ |
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
import redis | |
from django.conf import settings | |
from django.core.signals import request_finished | |
try: | |
from eventlet.corolocal import local | |
except ImportError: | |
from threading import local |
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 std::env; | |
use std::io; | |
use std::io::prelude::*; | |
use std::fs::File; | |
#[derive(Debug)] | |
enum Error { | |
Io(io::Error), | |
Program(&'static str), | |
} |
OlderNewer