This file contains hidden or 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 bash | |
| rm -rf "${HOME}/Library/Caches/CocoaPods" | |
| rm -rf "`pwd`/Pods/" | |
| pod update |
This file contains hidden or 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 serialport = require('node-serialport') | |
| var sp = new serialport.SerialPort("/dev/ttyO3", { | |
| parser: serialport.parsers.raw, | |
| baud: 9600 | |
| }) | |
| sp.on('data', function(chunk) { | |
| console.log(chunk.toString('hex'), chunk.toString(), chunk) | |
| }) |
This file contains hidden or 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
| // | |
| // CellBackgroundView.h | |
| // | |
| // | |
| #import <UIKit/UIKit.h> | |
| typedef enum { | |
| CellPositionTop, | |
| CellPositionMiddle, |
This file contains hidden or 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
| # Mac OSX Mountain Lion | |
| # Ruby on Rails Development Environment | |
| # RVM | |
| curl -L https://get.rvm.io | bash -s stable && rvm install 1.9.3 && rvm install 1.8.7 | |
| echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile | |
| source ~/.bash_profile | |
| # Disable rarely used RDOC |
This file contains hidden or 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
| # PIL RGB 'im' to CV2 BGR 'imcv' | |
| imcv = np.asarray(im)[:,:,::-1].copy() | |
| # Or | |
| imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR) | |
| # To gray image | |
| imcv = np.asarray(im.convert('L')) | |
| # Or | |
| imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2GRAY) |
This file contains hidden or 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
| @implementation AppDelegate | |
| void SwapMethodImplementations(Class cls, SEL left_sel, SEL right_sel) { | |
| Method leftMethod = class_getInstanceMethod(cls, left_sel); | |
| Method rightMethod = class_getInstanceMethod(cls, right_sel); | |
| method_exchangeImplementations(leftMethod, rightMethod); | |
| } | |
| + (void)initialize { | |
| if (self == [AppDelegate class]) { | |
| #ifdef __IPHONE_6_0 |
This file contains hidden or 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
| #define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate]) | |
| #define UserDefaults [NSUserDefaults standardUserDefaults] | |
| #define NotificationCenter [NSNotificationCenter defaultCenter] | |
| #define SharedApplication [UIApplication sharedApplication] | |
| #define Bundle [NSBundle mainBundle] | |
| #define MainScreen [UIScreen mainScreen] | |
| #define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
| #define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
| #define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
| #define NavBar self.navigationController.navigationBar |
This file contains hidden or 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
| #include <iterator> | |
| #include <algorithm> | |
| #include <vector> | |
| #include <map> | |
| #include <set> | |
| #include <iostream> | |
| #include <cassert> | |
| #include <memory> | |
| #include <future> | |
| #include <chrono> |
This file contains hidden or 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
| #Steps to install RVM + Ruby 1.9.3 + Rails + nginx + Passenger on CentOS (tested on v5.5) | |
| # Todo get up to date repo's | |
| # Install git and curl, if not already installed | |
| sudo yum install git | |
| sudo yum install curl-devel | |
| # Create the rvm group and add any users who will be using rvm to the group | |
| sudo su - |
This file contains hidden or 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
| // https://www.google.com/doodles/hurdles-2012 | |
| (function () { | |
| var h = void 0, | |
| i = !0, | |
| j = null, | |
| l = !1, | |
| m, n = this, | |
| aa = function (a, b) { | |
| var c = a.split("."), | |
| d = n; |