Skip to content

Instantly share code, notes, and snippets.

View azone's full-sized avatar
👨‍💻
Coding

Yozone Wang azone

👨‍💻
Coding
View GitHub Profile
@azone
azone / .gitignore
Created March 21, 2012 03:10 — forked from Abizern/.gitignore
Global git ignore file
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
@azone
azone / process_words.py
Created October 29, 2012 05:43
This is a interactive cli tool to solve the Letterpress game by Yozone Wang
#/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
import time
import math
GROUP = 4
COUNT = int(math.ceil(26.0 / GROUP))
PRIME_TUPLE = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31)
@azone
azone / open-in-blank.js
Created January 13, 2013 11:33
Open Octopress external link in new tab
function addBlankTargetForLinks () {
$('a[href^="http"]').each(function(){
$(this).attr('target', '_blank');
});
}
$(document).bind('DOMNodeInserted', function(event) {
addBlankTargetForLinks();
});
@azone
azone / HD.txt
Last active December 18, 2015 15:39 — forked from lexrus/HD.txt
http://devstreaming.apple.com/videos/wwdc/2013/710xfx3xn8197k4i9s2rvyb/710/710-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/202xdx2x47ezp1wein/202/202-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/200xdx2x35e1pxiinm/200/200-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/413xdx5x97itb5ek4yex3r7/413/413-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/612xax4xx65z1ervy5np1qb/612/612-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/221xex4xxohbllf4hblyngt/221/221-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/220xbx4xipaxfd1tggxuoib/220/220-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/711xcx4x8yuutk8sady6t9f/711/711-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/404xbx2xvp1eaaqonr8zokm/404/404-HD.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2013/505xbx4xrgmhwby4oiwkrpp/505/505-HD.mov?dl=1
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
#!/usr/bin/env bash
# Generates gource video (h.264) out of multiple repositories.
# Pass the repositories in command line arguments.
# Example:
# <this.sh> /path/to/repo1 /path/to/repo2
RESOLUTION="1920x1080"
outfile="gource.mp4"
i=0
@azone
azone / NilOrEmpty.swift
Created August 5, 2015 02:12
determine the CollectionType or String is nil or empty
public protocol Emptiable {
var isEmpty: Bool { get }
}
extension String: Emptiable {}
extension Optional where T: Emptiable {
public var isNilOrEmpty: Bool {
guard let obj = self else { return true }
return obj.isEmpty
@azone
azone / UIColor+Utils.swift
Last active March 23, 2016 10:21
将16进制字符串或者整型转换成 UIColor
//
// UIColor+Utils.swift
//
// Created by Yozone Wang on 15/12/17.
// Copyright © 2015年 Yozone Wang. All rights reserved.
//
import UIKit
private let UIColorCache = NSCache()
@azone
azone / listFiles.swift
Created May 23, 2016 07:33 — forked from kristopherjohnson/listFiles.swift
Example of using opendir/readdir/closedir with Swift
import Foundation
// Get current working directory
var wdbuf: [Int8] = Array(count: Int(MAXNAMLEN), repeatedValue: 0)
let workingDirectory = getcwd(&wdbuf, UInt(MAXNAMLEN))
println("Working directory: \(String.fromCString(workingDirectory)!)")
println("\nContents:")
// Open the directory
@azone
azone / Extensions.swift
Created April 8, 2020 09:47
Useful swift extensions for `Sequence` and `Optional` with `Collection` wrapper
public extension Sequence {
func all(_ predicate: (Element) throws -> Bool) rethrows -> Bool {
try allSatisfy(predicate)
}
func any(_ predicate: (Element) throws -> Bool) rethrows -> Bool {
try contains(where: predicate)
}
}