Skip to content

Instantly share code, notes, and snippets.

@syxc
syxc / ProxySettings.java
Created May 14, 2012 08:45 — forked from madeye/ProxySettings.java
Set proxy for Android Webview
package me.madeye;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.http.HttpHost;
import android.content.Context;
@syxc
syxc / windows.h__.js
Created November 19, 2012 01:54
windows.h.js INFINITY
var ffi = require('ffi'),
ref = require('ref'),
Struct = require('ref-struct'),
Library = require('./Library'),
Type = ref.Type,
NULL = ref.NULL,
isNull = ref.isNull;
var groups = ['libs', 'types', 'structs', 'callbacks', 'enums'];
@syxc
syxc / app.js
Created December 13, 2012 15:23 — forked from pixelhandler/app.js
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
- (void) viewDidLoad {
//...
comments.text = @"Comments";
comments.textColor = [UIColor lightGrayColor];
isEmpty = YES;
//...
}
- (BOOL)textViewShouldBeginEditing:(UITextView*)textView {
if (isEmpty) {
/*global $*/
(function () {
'use strict';
var $html = $('#html'),
$convert = $('#convert'),
$jade = $('#jade');
function normalizeLineBreaks(str) {
return str.replace(/(\r\n|\n|\r)/gm, '\n');
#import <UIKit/UIKit.h>
@interface UITextField (HideKeyBoard)
-(void)hideKeyBoard:(UIView *)view;
@end
@syxc
syxc / UIColor+Hex.h
Last active December 14, 2015 21:18 — forked from ohsc/UIColor+Hex.h
//
// UIColor+Hex.h
//
//
// Created by Shen Chao on 11-12-31.
// Copyright (c) 2011年 Test. All rights reserved.
//
#import <UIKit/UIKit.h>
//
// UIImage+Network.h
// Fireside
//
// Created by Soroush Khanlou on 8/25/12.
//
//
#import <UIKit/UIKit.h>
class Backend(object):
def __init__(self):
engine = create_engine("mysql://{0}:{1}@{2}/{3}".format(options.mysql_user, options.mysql_pass, options.mysql_host, options.mysql_db)
, pool_size = options.mysql_poolsize
, pool_recycle = 3600
, echo=options.debug
, echo_pool=options.debug)
self._session = sessionmaker(bind=engine)
@classmethod
#!upstart
description "Sitename-state"
author "Ben Gourley"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn # restart when job dies
respawn limit 5 60 # give up restart after 5 respawns in 60 seconds