Skip to content

Instantly share code, notes, and snippets.

View albertlieyingadrian's full-sized avatar
🤠

Albert Lie 이영덕 albertlieyingadrian

🤠
View GitHub Profile
@technoweenie
technoweenie / gist:1072829
Created July 8, 2011 21:12
.netrc file so you can push/pull to https git repos without entering your creds all the time
machine github.com
login technoweenie
password SECRET
machine api.github.com
login technoweenie
password SECRET
@peterssonjesper
peterssonjesper / gist:3286510
Created August 7, 2012 15:44
Inheritance example Javascript
// Parent class with two properties, one integer and one object
var ParentClass = function() {
this.counter = 0;
this.obj = { counter : 0 };
this.inca = function() {
this.counter++;
this.obj.counter++;
}
};
@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@olasitarska
olasitarska / pgessays.py
Created November 18, 2012 10:11
Builds epub book out of Paul Graham's essays.
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <[email protected]>
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html)
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
@tetsuok
tetsuok / printStruct.go
Created February 13, 2013 07:50
Printing structs; convert structs to JSON format easily.
// Printing structs.
// http://research.swtch.com/gotour
package main
import (
"encoding/json"
"fmt"
"log"
)
$ cat test.js
function foo () { while (true) { } }
function bar () { return foo(); }
bar();
$ node test.js &
$ gdb attach $(pidof node)
0x00000bf778c63d5f in ?? ()
(gdb) b v8::internal::Runtime_StackGuard
Breakpoint 1 at 0x84a1f0
(gdb) print 'v8::V8::TerminateExecution'(0)
chrome.webRequest.onHeadersReceived.addListener(
function (details) {
for (var i = 0; i < details.responseHeaders.length; ++i) {
if (details.responseHeaders[i].name.toLowerCase() == 'x-frame-options') {
details.responseHeaders.splice(i, 1);
return {
responseHeaders: details.responseHeaders
};
}
}
@mandiwise
mandiwise / Count lines in Git repo
Last active September 29, 2024 19:44
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@josephliccini
josephliccini / PalantirCodingChallenge.java
Last active November 20, 2021 12:08
Palantir Coding Challenge Question
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/**
* Credit for Algorithm from top answer in:
* http://stackoverflow.com/questions/7116438/algorithms-question-flipping-columns
*
* This problem is given to interview candidates in the screening process
* for Palantir Technologies. I've seen it through several different
@harlow
harlow / golang_job_queue.md
Last active October 30, 2024 13:27
Job queues in Golang