To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
- Homebrew
- Mountain Lion -> High Sierra
# Install QEMU OSX port with ARM support | |
sudo port install qemu +target_arm | |
export QEMU=$(which qemu-system-arm) | |
# Dowload kernel and export location | |
curl -OL \ | |
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie | |
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie | |
# Download filesystem and export location |
gettype = function (x) { | |
return {}.toString.call(x).match(/\s([a-zA-Z]+)/)[1]; | |
}; | |
diff = function () { | |
this.comp=null; // comparation object | |
this.hnd=function(){}; // no function | |
}; |
import UIKit | |
extension UIImage { | |
public enum GIFBehavior { | |
case unclamped, clamped(TimeInterval), webkit | |
fileprivate func duration(_ properties: Any?) -> TimeInterval? { | |
// Look for specified image duration; always prefer unclamped delay time | |
guard let properties: [String: Any] = (properties as? [String: Any])?["{GIF}"] as? [String: Any], |
package main | |
import ( | |
"code.google.com/p/gcfg" | |
"fmt" | |
r "github.com/dancannon/gorethink" | |
irc "github.com/fluffle/goirc/client" | |
"log" | |
"strings" | |
) |
var localStorageActionCreator = function(flux, store) { | |
var _timerId = null; | |
// only way I can think to get the dispatcher into the timer actions | |
// which are not real actions | |
var _dispatch = flux.dispatchBinder.dispatch; | |
// force save every little bit in case this storage object doesn't get a chance | |
// to save | |
setInterval(_persistData, 60 * 1000); |
extension Array { | |
func first() -> Element? { | |
if isEmpty { | |
return nil | |
} | |
return self[0] | |
} | |
func last() -> Element? { |
#!/bin/bash | |
usage () | |
{ | |
cat <<UsageHERE | |
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host | |
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT | |
or boot2docker-fwd -d RULE_NAME | |
or boot2docker-fwd -l | |
or boot2docker-fwd -A |
// Taken from http://PSPDFKit.com. This snippet is under public domain. | |
#define UIKitVersionNumber_iOS_7_0 0xB57 | |
BOOL PSPDFIsUIKitFlatMode(void) { | |
static BOOL isUIKitFlatMode = NO; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
// We get the modern UIKit if system is running >= iOS 7 and we were linked with >= SDK 7. | |
if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_7_0) { | |
isUIKitFlatMode = (NSVersionOfLinkTimeLibrary("UIKit") >> 16) >= UIKitVersionNumber_iOS_7_0; | |
} |
To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.
- (NSAttributedString *)attributedStringWithString:(NSString *)string highlightedwithOccurencesOfString:(NSString *)stringToHighlight inColor:(DTColor *)color | |
{ | |
// build an attributed string to start with | |
// font | |
DTCoreTextFontDescriptor *fontDesc = [[DTCoreTextFontDescriptor alloc] init]; | |
fontDesc.fontFamily = @"Helvetica"; | |
fontDesc.pointSize = 20; | |
// paragraph style |