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
function httpDecorator($delegate: ng.IHttpService) { | |
var $http = $delegate; | |
var wrapper = () => { | |
// interpolate the url | |
var config = arguments[0]; | |
config.url = interpolateUrl(config.url, config.params, config.data); | |
return $http.apply($http, arguments); | |
}; |
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
" Cycle metasyntactic variables | |
function! s:CycleMetasyntacticVariables(num) | |
if type(a:num) != type(0) | |
return | |
endif | |
let vars = ['foo', 'bar', 'baz', 'qux', 'quux', 'corge', 'grault', 'garply', 'waldo', 'fred', 'plugh', 'xyzzy', 'thud'] | |
let cvar = expand('<cword>') | |
let i = index(vars, cvar) |
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
/** | |
* Sets a default value for a given input. | |
* | |
* @param mixed input | |
* @param string defaultValue | |
* @return string | |
*/ | |
module.filter( 'default', [ '$filter', function( $filter ) { | |
return function( input, defaultValue ) { | |
if ( !input ) return defaultValue; |
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
#!/usr/bin/env node | |
var fs = require('fs'); | |
var path = require('path'); | |
var sass = require('node-sass'); | |
var ENV = process.env.SASS_ENV || 'development'; | |
var file = 'variables.scss'; | |
//if in dev, directly pass file to sass | |
if (ENV === "development") { |
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
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { | |
var cell: UITableViewCell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier) as UITableViewCell | |
if cell == nil { | |
cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: kCellIdentifier) | |
} | |
var rowData: NSDictionary = self.tableData[indexPath.row] as NSDictionary | |
// Add a check to make sure this exists |
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
class Container { | |
typealias Resolver = () -> AnyObject | |
private var _resolvers: [String: Resolver] = [:] | |
func register<T: AnyObject>(resolver: @autoclosure () -> T) { | |
let name = NSStringFromClass(T.self) | |
_resolvers[name] = resolver | |
} | |
func get<T: AnyObject>() -> T { |
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 Cocoa | |
// Only needed until we have class variables | |
var __SwizzleSayHello = { (who:String) -> String in | |
return "Hello, \(who)" | |
} | |
class Swizzle { | |
//Only needed until we have class variables | |
class var _sayHello : (String)->String { get{ return __SwizzleSayHello } set (swizzle) {__SwizzleSayHello = swizzle} } |
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
// Let's define a basic Swift class. | |
class Fruit { | |
var type=1 | |
var name="Apple" | |
var delicious=true | |
} | |
// We can get at some info about an instance of an object using reflect(), which returns a Mirror. | |
reflect(Fruit()).count | |
reflect(Fruit())[1].0 |
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
angular.module('myApp', ['ngPluralizeHtml']) | |
function AppController() { | |
var vm = this; | |
vm.count = 10; | |
} | |
.controller('AppController', AppController); |
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
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc"> | |
<dependencies> | |
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/> | |
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/> | |
</dependencies> | |
<scenes> | |
<!--View Controller--> | |
<scene sceneID="ufC-wZ-h7g"> | |
<objects> |