Skip to content

Instantly share code, notes, and snippets.

View vinhnx's full-sized avatar
🎯
focusing

Vinh Nguyen vinhnx

🎯
focusing
View GitHub Profile
@vinhnx
vinhnx / gist:3510004
Created August 29, 2012 10:25 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts [Windows version]

Sublime Text 2 – Useful Shortcuts (Windows)

General

ctrl+T go to file
ctrl+⌃P go to project
ctrl+R go to methods
⌃G go to line
ctrl+KB toggle side bar
ctrl+shift+P command prompt
@vinhnx
vinhnx / aprompt.png
Created October 4, 2012 16:20 — forked from mislav/aprompt.png
My zsh prompt. No oh-my-zsh needed
aprompt.png
@vinhnx
vinhnx / README.md
Created October 21, 2012 12:04 — forked from briangonzalez/README.md
img2boxshadow - a ruby script to convert images to CSS [http://codepen.io/briangonzalez/details/AvrGI#pen-details-tab]

img2boxshadow.rb

a ruby script to convert images to CSS (box-shadows)

Installation

gem install rmagick    # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
@vinhnx
vinhnx / new_gist_file
Created June 12, 2013 08:45 — forked from VivienCormier/new_gist_file
delay func
[self performSelector:@selector(closeAds) withObject:nil afterDelay:0.4];
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;
Anything added dilutes everything else.
Approachable is better than simple.
Avoid administrative distraction.
Design for failure.
Encourage flow.
Favor focus over features.
Half measures are as bad as nothing at all.
It's not fully shipped until it's fast.
Keep it logically awesome.
Mind your words, they are important.
@vinhnx
vinhnx / rAF.js
Created September 15, 2013 05:15 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
// cheers to @stroughtonsmith for helping out with this one
UIColor *barColour = [UIColor colorWithRed:0.13f green:0.14f blue:0.15f alpha:1.00f];
UIView *colourView = [[UIView alloc] initWithFrame:CGRectMake(0.f, -20.f, 320.f, 64.f)];
colourView.opaque = NO;
colourView.alpha = .7f;
colourView.backgroundColor = barColour;
self.navigationBar.barTintColor = barColour;
@vinhnx
vinhnx / gist:6750221
Created September 29, 2013 07:51 — forked from djaiss/gist:2938259
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
@vinhnx
vinhnx / htmltest.m
Created September 30, 2013 13:30 — forked from romaonthego/htmltest.m
- (void)viewDidLoad
{
[super viewDidLoad];
UITextView *textView = [[UITextView alloc] init];
textView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:textView];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[textView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(textView)]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(textView)]];
NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p><img src='http://blogs.babble.com/famecrawler/files/2010/11/mickey_mouse-1097.jpg' width=70 height=100 />";