This file contains 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
/*! window.js */ | |
var _window; | |
try { | |
_window = window; // running on browser | |
} catch(error) { | |
// running on node.js | |
} |
This file contains 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
#import <Foundation/Foundation.h> | |
@interface NSURL (dictionaryFromQueryString) | |
-(NSDictionary *) dictionaryFromQueryString; | |
@end |
This file contains 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
// | |
// NSUUID+UUIDOfUser.h | |
// | |
// Created by Yusuke Kawasaki on 2013/11/27. | |
// Copyright (c) 2013 Kawanet. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSUUID (UUIDOfUser) |
This file contains 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
#import <UIKit/UIKit.h> | |
@interface UIViewController (Util) | |
// Usage: | |
// FOOViewController *vc = [FOOViewController instantiateWithStoryboard:self.storyboard]; | |
// [self.navigationController pushViewController:vc animated:YES]; | |
+ (instancetype)instantiateWithStoryboard:(UIStoryboard *)storyboard; |
This file contains 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
/** | |
* This implements outerHTML method which jQuery is missing for long. | |
* @returns {String} outerHTML | |
* @example | |
* $("<p>foo</p>").addClass("bar").html(); // => "foo" | |
* $("<p>foo</p>").addClass("bar").outerHTML(); // => "<p class="bar">foo</p>" | |
*/ | |
jQuery.prototype.outerHTML = function(){ | |
var wrap = new jQuery("<div/>"); |
This file contains 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
/** | |
* @example | |
* | |
* var param1 = parse_query_param(location.search.substr(1)); | |
* | |
* var param2 = parse_query_param(location.hash.search(/^#!.*\?/)?"":location.hash.replace(/^#!.*\?/, "")) | |
*/ | |
function parse_query_param(query) { | |
var vars = query.split(/[&;]/); |
This file contains 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
/** | |
* Convert array of array to CSV (text/comma-separated-values) | |
* | |
* @param table {Array} array of array | |
* @returns {String} CSV | |
* @license MIT | |
* @see https://gist.github.com/kawanet/8438183 | |
*/ | |
function table_to_csv(table) { |
This file contains 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
/** | |
* @example | |
* Console.log("text", {"key":"value"}, ["array"]); | |
*/ | |
package { | |
import flash.external.ExternalInterface; | |
public class Console { | |
public static function log(message : String, ...args) : void { | |
if (!ExternalInterface.available) return; |
This file contains 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
/** | |
* @param {Object} query - query parameter object | |
* @param {String} `application/x-www-form-urlencoded` encoded string | |
*/ | |
function param(query) { | |
var list = []; | |
for(var key in query) { | |
var val = query[key]; | |
if ('object' === typeof val) { |
This file contains 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
server_tokens off; |