Skip to content

Instantly share code, notes, and snippets.

@hanxue
hanxue / # ruby - 2017-10-18_16-40-08.txt
Created October 19, 2017 03:35
ruby on macOS 10.10.5 - Homebrew build logs
Homebrew build logs for ruby on macOS 10.10.5
Build date: 2017-10-18 16:40:08
@hanxue
hanxue / 000_aggregated_migrations.rb
Created October 18, 2017 15:35
OpenProject database schema
#-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2017 Jean-Philippe Lang
@hanxue
hanxue / chrome-canvas-convert-to-webp.js
Created October 11, 2017 14:05
Chrome canvas convert image to webp
/*
* This file is a part of the Save Image As WebP project.
* Minimized by GCC.
*/
function openTabsAfterInstall() {
var domA = "chrome.google.com/webstore/detail/adaibkfbghiebecgfclpgpkgkmigmbmn";
chrome.tabs.create({
url: "https://" + domA,
selected: false,
pinned: false
@hanxue
hanxue / README.md
Created June 5, 2017 15:29 — forked from skanev/README.md
Hacky git diff syntax highlighting for the full code

Hacky syntax highlighting in git diff

Normally git diff would color additions green and deletions red. This is cool, but it would be even cooler if it adds syntax highlighting to those lines. This is a git pager that does so.

It parses the diff output and picks up the SHAs of files with additions and deletions. It uses [CodeRay][coderay] to highlight each file and then it extracts the lines that are shown in the diff. It then uses [term/ansicolor][color] to make a gradient from the CodeRay color and the diff color (red for deletion, green for addition) and uses it to replace the original.

I tried using rugged instead of shelling out to git show – it was faster overall, but it did incur a noticeable start up time.

Check out the image below for a demo.

@hanxue
hanxue / 00.options.out
Last active May 15, 2017 11:51
Homebrew compiling ruby 2.4.1. failed
ruby --with-doc --with-gdbm --with-gmp --with-libffi
@hanxue
hanxue / system_operator_view.php
Created April 25, 2016 10:04
PHP syntax error VMS
<?php
# +-------------------------------------------------------------------------------------------------------+
# | |
# | Copyright (c) 2012 |
# | |
# | For the full copyright and license information, please view the LICENSE |
# | file that was distributed with this source code. |
# +----------------------------------------------------------------------------------------------------------+
require_once( "../../WEB_INF/controller.php" );
$rs = VmsController( "oper_user_list" );
@hanxue
hanxue / xcodebuild_ichm.txt
Created April 25, 2016 04:15
Xcode build error for iCHm 1.5
$ xcodebuild -project /tmp/ichm-1.5/ichm.xcodeproj/ -target "iChm" SYMROOT=build -verbose
Build settings from command line:
SYMROOT = build
=== BUILD TARGET iChm OF PROJECT ichm WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
Write auxiliary files
/bin/mkdir -p /var/folders/_0/bvqq9l5d2ngg0stvkf53jrbr0000gn/C/com.apple.DeveloperTools/6.4-6E35b/Xcode/SharedPrecompiledHeaders/ichm_Prefix-dicwfuazkgvsaxbqigqbykbkisfw
@hanxue
hanxue / KernSmooth_R_package_info.txt
Created April 15, 2016 18:06
R Package Info for KernSmooth
Package: KernSmooth
Priority: recommended
Version: 2.23-15
Date: 2015-06-29
Title: Functions for Kernel Smoothing Supporting Wand & Jones
(1995)
Authors@R: c(person("Matt", "Wand", role = "aut", email =
"[email protected]"), person("Brian", "Ripley", role
= c("trl", "cre", "ctb"), email =
"[email protected]", comment = "R port and
@hanxue
hanxue / twitter_word_cloud_najib.R
Created March 13, 2016 08:25
Twitter WordCloud for Najib Using R
library(twitteR)
library(ROAuth)
library(tm)
library(plyr)
library(ggplot2)
library(wordcloud)
library(RColorBrewer)
library(XML)
my.key <- Sys.getenv("TWITTER_KEY")
@hanxue
hanxue / twitter_word_cloud.R
Created March 11, 2016 16:40
Example of Twitter Word Cloud Using R
library(twitteR)
library(ROAuth)
library(tm)
library(wordcloud)
my.key <- "xxx"
my.secret <- "xxx"
access.token <- "123-xxx"
access.token.secret <- "xxx"