Skip to content

Instantly share code, notes, and snippets.

div > .vimiumHintMarker {
/* linkhint boxes */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#565756),
color-stop(100%,#242524));
border: 1px solid #e4e5e4;
opacity: 1.0;
text-shadow: none !important;
}
div > .vimiumHintMarker span {
@hlung
hlung / vimium-dvorak-keys.txt
Last active June 8, 2017 03:15
Dvorak - Vimium Custom key mappings.This *unmaps* all keys and only adds frequently used ones.
# ::: Dvorak - Vimium Custom key mappings :::
# NOTE: This *unmaps* all keys and only adds frequently used ones.
# It mainly uses left hand keys so you don't have to let go of the mouse.
# How to use: open Vimium option screen, put this in "Custom key mappings" section.
 
unmapAll
 
# Link
map u LinkHints.activateMode
map U LinkHints.activateModeToOpenInNewTab
@hlung
hlung / POS Store log.txt
Created April 2, 2015 11:29
POS Store log
2015-04-02 18:27:43.897 Baccarat[18273:1755018] INFO: POST [START] : https://api.fingi-develop.com/v3/companies/12/brands/20/properties/30/rooms/1624/store_shopping_cart_items
2015-04-02 18:27:43.897 Baccarat[18273:1755018] VERBOSE: body : {
"store_name" = "pos_store";
"store_shopping_cart_item" = {
"item_quantity" = 1;
"item_selection" = "";
"item_tag" = "pos_bagel";
"pos_item_id" = 10026;
};
}
@hlung
hlung / UIColor+PXExtensions.h
Last active December 30, 2020 20:59
Make UIColor support hex color codes
//
// UIColor+PXExtensions.h
// Creates UIColor from hex string. "#" prefix is optional. Supports 3 and 6 hex digits.
// Originally from http://pixelchild.com.au/post/12785987198/how-to-convert-a-html-hex-string-into-uicolor-with
// But that link seems to be broken.
// Revived by Thongchai Kolyutsakul (21 May 2015).
//
// USAGE: UIColor *mycolor = [UIColor pxColorWithHexValue:@"#BADA55"];
// UIColor *mycolor = [UIColor pxColorWithHexValue:@"FFFFFF"];
// UIColor *mycolor = [UIColor pxColorWithHexValue:@"1AD"];
@hlung
hlung / test.json
Created May 22, 2015 05:47
Test various JSON values through NSJSONSerialization and see Bool results
{
"name": "hahaha",
"a_null": null,
"a_true": true,
"a_false": false,
"a_n1": -1,
"a_0": 0,
"a_1": 1,
"a_2": 2,
}
@hlung
hlung / UIRefreshControl+beginRefreshing.h
Last active October 10, 2018 09:31
A UIRefreshControl beginRefreshing method that actually works
//
// UIRefreshControl+beginRefreshing.h
// Kibo
//
// Created by Hlung on 3/6/15.
// MIT License
//
#import <UIKit/UIKit.h>
@hlung
hlung / gist:0f30addbda7cc0510bb3
Created September 9, 2015 11:15
NSArray of US state names and abbreviations :)
- (NSArray*)usStateAbbreviations {
static NSArray *array = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
array = @[@"AL", @"AK", @"AZ", @"AR", @"CA", @"CO", @"CT", @"DE", @"FL", @"GA", @"HI", @"ID", @"IL", @"IN", @"IA", @"KS", @"KY", @"LA", @"ME", @"MD", @"MA", @"MI", @"MN", @"MS", @"MO", @"MT", @"NE", @"NV", @"NH", @"NJ", @"NM", @"NY", @"NC", @"ND", @"OH", @"OK", @"OR", @"PA", @"RI", @"SC", @"SD", @"TN", @"TX", @"UT", @"VT", @"VA", @"WA", @"WV", @"WI", @"WY"];
});
return array;
}
- (NSArray*)usStateNames {
@hlung
hlung / BDBOAuth1SessionManager+KBExtension.h
Created December 15, 2015 05:55
BDBOAuth1SessionManager+KBExtension
#import <Foundation/Foundation.h>
#import "BDBOAuth1SessionManager.h"
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090)
@interface BDBOAuth1SessionManager (KBExtension)
/**
* Sends a generic OAuth signed request (using "Authentication" header) for JSON object.
* You should have successfully fetched access token first before using this method.
@hlung
hlung / UIView+TouchableViews.swift
Created January 5, 2016 06:51
Make subviews touchable even if it is outside its superview bounds.
// Make subviews touchable even if it is outside its superview bounds.
// ** Add more views here **
lazy var touchableViews: [UIView] = {
return [self.voteUpButton, self.voteDownButton, self.authorDetailButton]
}()
// Boilerplate
override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
for view in touchableViews {
@hlung
hlung / CachedFibonacci.swift
Last active January 11, 2016 15:57
A Swift 2 function that calculates a fibonacci number, then cached it in a dictionary for later use. Max value of `Double` is 1.79769313486232e+308. Note: there is a faster way to calculate this if you need to jump later numbers. It's called "fast doubling", see https://vinayakgarg.wordpress.com/2012/11/07/fastest-way-to-compute-fibonacci-number/
typealias NumType = Double
var calculatedFibs = [NumType: NumType]()
func fib(num: NumType) -> NumType {
guard num > 1 else { // when num is 0, 1, just return 0, 1.
return num
}
if let cached = calculatedFibs[num] { // read cache
return cached