Skip to content

Instantly share code, notes, and snippets.

@witochandra
witochandra / methods.m
Last active August 29, 2015 14:08
EDSDK
// Start Video Recording
- (EdsError)startVideoRecording {
EdsError error;
EdsUInt32 saveTo = kEdsSaveTo_Camera;
EdsUInt32 recordStart = 4;
error = EdsSetPropertyData(_camera, kEdsPropID_SaveTo, 0, sizeof(saveTo) , &saveTo);
if (error == EDS_ERR_OK) error = EdsGetPropertyData(_camera, kEdsPropID_Record, 0, sizeof(recordStart), &recordStart);
if (error == EDS_ERR_OK && recordStart != 4) {
recordStart = 4;
error = EdsSetPropertyData(_camera, kEdsPropID_Record, 0, sizeof(recordStart), &recordStart);
if independent_ingredient.shopping_list.user_id != current_user.id
@receiver = User.find_by_id(independent_ingredient.shopping_list.user_id)
end
if independent_ingredient.assigned_user_id != current_user.id
@receiver = User.find_by_id(independent_ingredient.assigned_user_id)
end
- (void)keyboardDidShow:(NSNotification *)notification {
NSDictionary *info = [notification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
UIEdgeInsets contentInsets;
CGRect aRect = self.view.bounds;
CGFloat kbHeight;
if(UIDeviceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
kbHeight = kbSize.height;
} else {
kbHeight = kbSize.width;
# Unique Value
def unique(params):
result = dict()
for i in params:
if result.has_key(i):
result[i] = result[i] + 1
else:
result[i] = 1
for i in result.keys():
if result[i] == 1:

Status codes

[200] OK
[404] Not found 
[520] <Custom error message>
[521] Camera not found
[522] Camera busy

@witochandra
witochandra / NERDTree.mkd
Created June 30, 2014 04:25 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@witochandra
witochandra / xortree.py
Last active August 29, 2015 14:03
XOR tree
# 429A
# Xor-tree
class Node:
def __init__(self, name, value, parent = None):
self.name = 0
self.value = 0
self.grandChildren = list()
self.setParent(parent)
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
// ===========================================================
// Constructors
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
Wito:~ witochandra$ man bash
Wito:~ witochandra$
Wito:~ witochandra$ cat .bash_profile
function tabname {
@witochandra
witochandra / .bash_profile
Last active August 29, 2015 14:00
dotfiles
function tabname {
printf "\e]1;$1\a"
}
# added by Anaconda 1.9.1 installer
# export PATH="/Users/witochandra/anaconda/bin:$PATH"
# homebrew
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"