Skip to content

Instantly share code, notes, and snippets.

var ifThenElse = new Function(
"c",
"t",
"f",
String.fromCharCode.apply(null, [
105,
102,
40,
99,
41,

Keybase proof

I hereby claim:

  • I am alfredxing on github.
  • I am alfredxing (https://keybase.io/alfredxing) on keybase.
  • I have a public key whose fingerprint is 5081 99C5 391F 6F0C 5BB6 6105 1CFE 4154 8790 697C

To claim this, I am signing this object:

@alfredxing
alfredxing / jekyll.test
Created November 23, 2014 06:10
Jekyll unit tests on Windows, Ruby 2.1.5
Run options:
# Running tests:
...........................F..................................................................................F..F........................FFFFF................................................F.E............................New jekyll site installed in c:/Users/Alfred/Desktop/jekyll/new-site.
..................................................................................................................................E.............FF........F..............F......FE.................E.....EEEEE.......E.......EEEEE..................................
Finished tests in 52.009567s, 9.2675 tests/s, 14.4589 assertions/s.
1) Failure:
@alfredxing
alfredxing / after
Last active August 29, 2015 14:09
Jekyll build times (tested with the jekyllrb.com site)
user system total real
reset: 0.000000 0.000000 0.000000 ( 0.000018)
read: 0.060000 0.000000 0.060000 ( 0.059700)
generate: 0.000000 0.000000 0.000000 ( 0.000015)
render: 0.010000 0.000000 0.010000 ( 0.001485)
write: 0.020000 0.000000 0.020000 ( 0.028919)
@alfredxing
alfredxing / svg.py
Created August 10, 2014 17:21
Replace font ID's for Brick SVG fonts
import glob
import os
import re
fonts = glob.glob('/Users/alfred/Documents/Git/brick/fonts/*/*.svg')
for font in fonts:
print 'Processing %s...' % font,
font_id = os.path.basename(os.path.dirname(font))
f = open(font, 'r')
contents = f.read()
@alfredxing
alfredxing / wonderful.zsh-theme
Last active August 29, 2015 14:04
Wonderful: A ZSH theme
git_prompt_info () {
if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]
then
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(parse_git_dirty)${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
PROMPT='%{$fg[blue]%}%* %{$fg_bold[cyan]%}%~%{$reset_color%}%{$fg[blue]%}$(git_prompt_info) %{$fg[red]%}➜%{$reset_color%} '
@alfredxing
alfredxing / README.md
Created December 24, 2013 17:27
Update Chromium automatically from the command line.

Automatically update Chromium (Windows with Bash)

Prerequisites:

  • wget

Installation:

  1. Create a file called version.txt in your Chromium/Application folder, with 0 as its contents.

Usage:

Just run the script!

@alfredxing
alfredxing / frame.html
Last active December 17, 2015 03:39
Textdown single-frame working mode with preview toggle.
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
overflow-x: hidden;
-webkit-transition: 0.2s opacity ease 0.25s;
}
body.pre {
@alfredxing
alfredxing / csv.php
Last active December 16, 2015 19:30
Saving SQL Server query data to a CSV file (query from GET/POST request)
<?php
/**
* Connect to SQL server (SQLSRV can also be used, I used MSSQL because Native Client isn't needed)
* Replace <server>, <username>, and <password> with the appropriate details
*/
$link = mssql_connect("<server>", '<username>', '<password>');
if (!$link)
{