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
// Handy function to render dynamic parameters in a dust.js helper | |
function renderParameter(name, chunk, context, bodies, params) { | |
if (params && params[name]) { | |
if (typeof params[name] === "function") { | |
var output = ""; | |
chunk.tap(function (data) { | |
output += data; | |
return ""; | |
}).render(params[name], context).untap(); | |
return output; |
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 request = require('request'), //ezmode | |
fs = require('fs'); | |
var uploadFileName = 'tit.jpg'; // this is a local file, but could be any file or data you want to read in | |
//ITS A BIRD I SWEAR | |
fs.readFile('./' + uploadFileName, function read(err, data) { | |
// hipchat appears to expect the file as a byte array | |
// and does not support Content-Transfer-Encoding at the time of this gist's creation | |
request.post({ |
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
*************************************************************************************************** | |
DISCLAIMER: | |
I did not write this, I found it on Stack Overflow attributed to user Sophtware. Finding it useful, I decided to save this here, in case SO deleted the page (since the question was closed as a non-question) | |
*************************************************************************************************** | |
void dumpViews(UIView* view, NSString *text, NSString *indent) | |
{ | |
Class cl = [view class]; | |
NSString *classDescription = [cl description]; |
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
// | |
// Created by Alex Hajdu on 5/27/13. | |
// Copyright (c) 2013 Mr.Fox and friends. All rights reserved. | |
// | |
// To change the template use AppCode | Preferences | File Templates. | |
// | |
#import <Foundation/Foundation.h> |
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 QuartzCore | |
class ViewController: UIViewController { | |
@IBOutlet weak var label: UILabel | |
@IBOutlet weak var counter: UILabel | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
// | |
// MKMapViewExtension.swift | |
// AutocompleteTextfieldSwift | |
// | |
// Created by Mylene Bayan on 2/22/15. | |
// Copyright (c) 2015 MaiLin. All rights reserved. | |
// | |
import Foundation | |
import MapKit |
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
package com.bulwinkel.android | |
import android.os.Bundle | |
import android.os.IBinder | |
import android.os.Parcelable | |
import java.io.Serializable | |
fun <V> Map<String, V>.toBundle(bundle: Bundle = Bundle()): Bundle = bundle.apply { | |
forEach { | |
val k = it.key |
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
// Created by Ullrich Schäfer on 16/08/14. | |
// Bitmasks are a bit tricky in swift | |
// See http://natecook.com/blog/2014/07/swift-options-bitmask-generator/ | |
//enum LogFlag: Int32 { | |
// case Error = 0b1 | |
// case Warn = 0b10 | |
// case Info = 0b100 |
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
precedencegroup ForwardPipe { | |
associativity: left | |
} | |
infix operator |> : ForwardPipe | |
func |> <T, U>(value: T, function: ((T) -> U)) -> U { | |
return function(value) | |
} |
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/bash | |
# Usage: | |
# $ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates | |
# $ bash ~/remove-boilerplate-comments-from-xcode-templates.sh | |
# Repeat for /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates | |
find -E . -type f \ | |
\( -regex '.*\.[chm]' -or -regex '.*\.swift' \) \ | |
-exec sed -i '' '1,/^$/d' '{}' ';' |
OlderNewer