Skip to content

Instantly share code, notes, and snippets.

View hjue's full-sized avatar

hjue hjue

  • Beijing, China
View GitHub Profile
@hjue
hjue / nginx.conf
Created April 22, 2013 05:30 — forked from hydra35/nginx.conf
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
<html>
<head>
<title>WebSocket Demo</title>
</head>
<style type="text/css">
textarea{width:400px;height:150px;display:block;overflow-y:scroll;}
#output{width:600px;height:400px;background:whiteSmoke;padding:1em .5em;color:#000;border:none;}
button{padding:.2em 1em;}
</style>
<link href="layout.css" rel="stylesheet" type="text/css" />
@hjue
hjue / ExampleClass.m
Created May 11, 2013 03:07 — forked from lukeredpath/ExampleClass.m
GCDSingleton
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
#import <CoreLocation/CoreLocation.h>
#import <ImageIO/ImageIO.h>
@interface CLLocation (EXIFGPS)
- (NSDictionary*) EXIFMetadataWithHeading:(CLHeading*)heading;
@end
@interface NSDate (EXIFGPS)
@hjue
hjue / server.js
Created December 27, 2013 08:03 — forked from ziahamza/server.js
var http = require('http'),
fs = require('fs'),
path = require('path'),
exec = require('child_process').exec;
function pipeDoc(inputPath, finalType, stream) {
var finalPath = path.dirname(inputPath)
+ "/" + path.basename(inputPath).split('.')[0] + ".html";
var convCommand = 'unoconv -f ' + finalType + " " + inputPath;
exec(convCommand,function(err, stdout, stderr) {
#import "MobClickOpenUDID+Swizzled.h"
#import <objc/message.h>
#import <JRSwizzle.h> // Swizzle 类方法,这样可以避免类去调用某些Apple可能不允许的方法,通过审核
#import "YourDevice.h" // 你的设备相关类,用于生成自己的Device Unique ID
#import <RegExCategories.h> // 正则表达式
#import <NSString+Ruby.h> // 字符串工具类
static NSString * const kOpenUDIDKey = @"OpenUDID";
static NSString * const kOpenUDIDSlotKey = @"OpenUDID_slot";
@hjue
hjue / fix-xcode
Created March 15, 2014 15:00 — forked from rnapier/fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode, add the script's path to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
var flow = webdriver.promise.controlFlow();
var finish = function (done) {
driver.quit().then(function () {
done();
});
};
var error = function (e) {
driver.quit().then(function () {
// Add the following to your preferences file
"folder_exclude_patterns":[".git","node_modules"]