Skip to content

Instantly share code, notes, and snippets.

View memorysaver's full-sized avatar

Ming-Cheng Ho memorysaver

View GitHub Profile
@memorysaver
memorysaver / gist:4d2082f47f3b27463a91679020dc1407
Created August 8, 2016 16:40 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@memorysaver
memorysaver / .gitconfig
Created August 20, 2016 18:56 — forked from rab/.gitconfig
A good starting point for ~/.gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@memorysaver
memorysaver / objc.m
Last active November 9, 2016 00:17 — forked from sodastsai/objc.m
ObjectiveC Lightweight Generic
@interface BaseViewModel : NSObject
- (void)baseMethod;
@end
@implementation BaseViewModel
- (void)baseMethod {}
@end
// ---------------------------------------------------------------------------------------------------------------------
@memorysaver
memorysaver / gen.swift
Created November 14, 2016 18:59 — forked from blainerothrock/gen.swift
A Very Simple Genetic Algorithm Written in Swift 3
#!/usr/bin/env xcrun swift -O
/*
gen.swift is a direct port of cfdrake's helloevolve.py from Python 2.7 to Swift 3
-------------------- https://gist.github.com/cfdrake/973505 ---------------------
gen.swift implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many

Videos

@memorysaver
memorysaver / iflet.m
Created January 12, 2017 13:11 — forked from CraigSiemens/iflet.m
if-let and guard macros for Objective C
#import <Foundation/Foundation.h>
// VARIABLE must be a variable declaration (NSString *foo)
// VALUE is what you are checking is not nil
// WHERE is an additional BOOL condition
#define iflet(VARIABLE, VALUE) \
ifletwhere(VARIABLE, VALUE, YES)
#define ifletwhere(VARIABLE, VALUE, WHERE) \
@memorysaver
memorysaver / ARKonamiKeyboardView.h
Created January 31, 2017 09:07 — forked from dblock/ARKonamiKeyboardView.h
ASCII Art + Konami Code Easter Egg for iOS
//
// ARKonamiKeyboardView.h
// Artsy
//
// Created by Daniel Doubrovkine on 3/21/14.
// Copyright (c) 2014 Art.sy. All rights reserved.
//
#import <DRKonamiCode/DRKonamiGestureRecognizer.h>
#!/bin/bash
# Run docker to build
#docker run -v $(pwd):/outputs -it amazonlinux:2016.09 \
# /bin/bash /outputs/build.sh
set -ex
yum update -y
yum install -y \
f <-- find a character
; <-- repeat find (f)
. <-- repeat action
shift+v <-- select all line
: <-- command (f:x) this can repeat an action