Skip to content

Instantly share code, notes, and snippets.

View shanzi's full-sized avatar

Chase Zhang shanzi

View GitHub Profile
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@denji
denji / http-benchmark.md
Last active March 27, 2025 19:46
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@yinian1992
yinian1992 / truncate.py
Last active December 25, 2015 13:59
Proper truncate template filter considering char width
import unicodedata
from django import template
register = template.Library()
@register.filter
def truncate(text, max_length):
max_length = int(max_length) - 3
@stefanobernardi
stefanobernardi / application_controller.rb
Created September 23, 2012 07:07
Multiple omniauth providers and omniauth-identity on the main user model
class ApplicationController < ActionController::Base
protect_from_forgery
protected
def current_user
@current_user ||= User.find_by_id(session[:user_id])
end
def signed_in?
@alexspeller
alexspeller / source_maps.rb
Created September 16, 2012 00:03
Coffeescript Source Maps in Rails
# config/initializers/source_maps.rb
if Rails.env.development?
require 'open3'
module CoffeeScript
class SourceMapError < StandardError; end;
class << self
def map_dir
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active March 31, 2025 23:38
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@vsajip
vsajip / ansistrm.py
Created December 29, 2010 11:14
Python logging: colourising terminal output
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {