Skip to content

Instantly share code, notes, and snippets.

View zhuqling's full-sized avatar

zhuqling zhuqling

  • @xinsailei
  • Guangzhou
View GitHub Profile
@zhuqling
zhuqling / animations.css
Created March 14, 2013 04:08 — forked from Twipped/animations.css
CSS3 动画效果集合, 也可以直接使用Animate.css @ http://daneden.me/animate/
.animated {
-webkit-animation: 1s ease;
-moz-animation: 1s ease;
-ms-animation: 1s ease;
-o-animation: 1s ease;
animation: 1s ease;
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
// Additional code in node-http-proxy.js
var crypto = require('crypto');
var redis = require('redis');
var client = redis.createClient(config.opt.redis_port, 'cloudno.de');
client.auth(config.opt.redis_auth, function(result) {
util.log("Redis authenticated.");
})
/*
* FormData for XMLHttpRequest 2 - Polyfill for Web Worker
* (c) 2014 Rob Wu <rob@robwu.nl>
* License: MIT
* - append(name, value[, filename])
* - XMLHttpRequest.prototype.send(object FormData)
*
* Specification: http://www.w3.org/TR/XMLHttpRequest/#formdata
* http://www.w3.org/TR/XMLHttpRequest/#the-send-method
* The .append() implementation also accepts Uint8Array and ArrayBuffer objects
import os
import random
from scrapy.conf import settings
class RandomUserAgentMiddleware(object):
def process_request(self, request, spider):
ua = random.choice(settings.get('USER_AGENT_LIST'))
if ua:
request.headers.setdefault('User-Agent', ua)
class ProxyMiddleware(object):
@zhuqling
zhuqling / makeAnimatedGif.m
Last active August 29, 2015 14:28 — forked from mayoff/makeAnimatedGif.m
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@zhuqling
zhuqling / gist:ae8c43fb69605e2e55db
Last active August 29, 2015 14:28 — forked from akisute/gist:1141953
Create an animated gif file from images in iOS
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
- (void)exportAnimatedGif
{
UIImage *shacho = [UIImage imageNamed:@"shacho.png"];
UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"];
NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"];
@zhuqling
zhuqling / trim_enabler.txt
Last active September 4, 2015 02:25 — forked from return1/trim_enabler.txt
TRIM Enabler for OS X Yosemite 10.10.3
#
# UPDATE for 10.10.4: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs
# just run "sudo trimforce enable" to activate the trim support from now on!
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
@zhuqling
zhuqling / index.html
Created January 12, 2016 01:34 — forked from anonymous/index.html
Shadow footer // source http://jsbin.com/yohiqe
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Shadow footer</title>
<style id="jsbin-css">
footer {
position: fixed;
bottom: 0;
@zhuqling
zhuqling / index.html
Created January 12, 2016 01:36 — forked from anonymous/index.html
JS Bin // source http://jsbin.com/pitiqu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: 'fira-sans', sans-serif;
}
span.nowrap {