Skip to content

Instantly share code, notes, and snippets.

@hieuk09
hieuk09 / pt_link_copier.js
Last active April 19, 2021 08:22
Pivotar Tracker Link copier
@hieuk09
hieuk09 / pt_commit_link.js
Last active December 22, 2015 17:18
Pivotal Link for commit
@hieuk09
hieuk09 / gist:6745070
Created September 28, 2013 18:39
Auto unfriend facebook
// ==UserScript==
// @name Unfriend In Single-Click on Facebook by Cha
// @description This script is useful if you don't want to delete each friends one by one.
// @namespace Cha
// @include *.facebook.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js
// @version 3.6.1
// ==/UserScript==
// Developed by Cha(Muhammad Rafizan) - http://fb.com/cha.dae.woong.sunbae

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@hieuk09
hieuk09 / polymorphic_sample.rb
Last active August 29, 2015 14:07
Polymorphic sample
class Animal
def name
'animal'
end
end
class Cow < Animal
def name
'cow'
end
namespace :something do
task execute_patch: :environment do
# OtherClass is used in MyClass
OtherClass.class_eval do
def foo
'bar'
end
end
loop do
@hieuk09
hieuk09 / gist:09d485626911bdfd7c79
Created April 19, 2015 14:29
Download with progress bar
require 'open-uri'
require 'fileutils'
require 'ruby-progressbar'
progress_bar = ProgressBar.create(
starting_at: 0,
total: nil,
format: "%a %B %p%% %r KB/sec",
rate_scale: lambda { |rate| rate / 1024 }
)
@hieuk09
hieuk09 / runner.sh
Last active August 29, 2015 14:23
Runner for json serializer benchmark
#!/bin/bash
array=("master" "acts_as_api" "active_model_serializers" "jbuilder" "jbuilder_with_partial" "rabl" "roar")
for i in "${array[@]}"
do
env -i git checkout $i
rspec
done
describe "validations" do
it "validates presence of github_username" do
acceptance = build(:acceptance, github_username: "")
expect(acceptance).to be_invalid
expect(acceptance.errors[:github_username]).to eq(["can't be blank"])
end
it "bubbles up user validations" do
acceptance = build(:acceptance, password: "")
@hieuk09
hieuk09 / nes.md
Last active March 1, 2017 18:08
Note on NES specification

Note on NES specification

Introduction

NES is Nintendo Entertainment System, a gaming console which is popular in 1980s

Hardware Overview

Since I'm reading the specification while implementing the emulator for Chip8, there will be some comparison between them.