Skip to content

Instantly share code, notes, and snippets.

View trevorwang's full-sized avatar
:octocat:
Focusing

Trevor Wang trevorwang

:octocat:
Focusing
View GitHub Profile
@trevorwang
trevorwang / mountain-lion-brew-setup.markdown
Created July 31, 2012 04:52 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@trevorwang
trevorwang / DismissMe.m
Created December 5, 2012 02:49 — forked from Adam0101/DismissMe.m
Example of a simple way to dismiss the iphone keyboard when a user clicks anywhere but the textfield
- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event {
for (UIView* view in self.view.subviews) {
if ([view isKindOfClass:[UITextField class]])
[view resignFirstResponder];
}
}
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
public class RecorderService extends AccessibilityService {
static final String TAG = "RecorderService";
private String getEventType(AccessibilityEvent event) {
[submodule "amqp"]
path = amqp
url = http://github.com/ry/node-amqp.git
require 'mongoid'
Mongoid::Config.instance.from_hash({"database" => "oid"})
class Tweeter
include Mongoid::Document
field :user
embeds_many :tweets
end
# from http://stackoverflow.com/questions/6499654/is-there-an-asynchronous-logging-library-for-ruby/6527134#6527134
require 'thread'
require 'singleton'
require 'delegate'
require 'monitor'
class Async
include Singleton
#!/bin/bash
HOST=$(hostname)
function install_postfix() {
echo | sudo debconf-set-selections <<__EOF
postfix postfix/root_address string
postfix postfix/rfc1035_violation boolean false
postfix postfix/mydomain_warning boolean
postfix postfix/mynetworks string 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
@trevorwang
trevorwang / gist:a0a435f9c5ccad3b0b55
Created November 13, 2014 02:36
Android 5.0 crash
11-13 10:33:01.968 10143 10346 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 10346 (RenderThread)
11-13 10:33:02.071 182 182 I DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-13 10:33:02.071 182 182 I DEBUG : Build fingerprint: 'google/hammerhead/hammerhead:5.0/LRX21O/1570415:user/release-keys'
11-13 10:33:02.071 182 182 I DEBUG : Revision: '11'
11-13 10:33:02.071 182 182 I DEBUG : ABI: 'arm'
11-13 10:33:02.071 182 182 I DEBUG : pid: 10143, tid: 10346, name: RenderThread >>> com.cisco.im <<<
11-13 10:33:02.071 182 182 I DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
11-13 10:33:02.100 182 182 I DEBUG : r0 bee89f30 r1 00000000 r2 00000001 r3 00000000
11-13 10:33:02.100 182 182 I DEBUG : r4 00000003 r5 0051d083 r6 9b4a0380 r7 9b4a03e0
11-13 10:33:02.100 182 182 I DEBUG : r8 9b4a038c r9 991ffd08 sl 991ffd00 fp 9b4a03c8
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@trevorwang
trevorwang / NSDateFormatter cheat sheet
Created January 26, 2016 08:58 — forked from romaonthego/NSDateFormatter cheat sheet
Date Formats for NSDateFormatter
a: AM/PM
A: 0~86399999 (Millisecond of Day)
c/cc: 1~7 (Day of Week)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
d: 1~31 (0 padded Day of Month)
D: 1~366 (0 padded Day of Year)