Skip to content

Instantly share code, notes, and snippets.

View lunaroyster's full-sized avatar

Arnav Bansal lunaroyster

View GitHub Profile
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@telent
telent / gist:9742059
Last active May 8, 2024 11:36
12 factor app configuration vs leaking environment variables
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
@staltz
staltz / introrx.md
Last active July 19, 2024 22:21
The introduction to Reactive Programming you've been missing
@VinGarcia
VinGarcia / walksync.js
Last active September 9, 2020 11:18 — forked from kethinov/walksync.js
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
if( dir[dir.length-1] != '/') dir=dir.concat('/')
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
@roachhd
roachhd / README.md
Last active July 18, 2024 07:24
Basics of BrainFuck

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

BrainFuck Programming Tutorial by: Katie

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

INTRODUCTION

@manigandham
manigandham / rich-text-html-editors.md
Last active June 10, 2024 15:49
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@Namek
Namek / app.ts
Created January 23, 2016 01:29
Angular 2 directive: two-way binding to contenteditable
@Component({
selector: 'test-component'
})
@View({
directives: [ContenteditableModel]
template: `
<h1 contenteditable="true" [(contenteditableModel)]="someObj.someProperty"></h1>
{{someObj | json}}
`
})
anonymous
anonymous / Stringlengthsort.py
Created August 17, 2017 08:41
print sorted(input("Enter your Strings: "), key=lambda string: len(string))
@lunaroyster
lunaroyster / TickGenerator.js
Created August 30, 2017 15:59
Generates ticks. Adjust tick length. Start and stop generator.
var on = function(name, handler) {
if(this._events.hasOwnProperty(name)) {
this._events[name].push(handler);
}
else {
this._events[name] = [handler];
}
};
var invoke = function(name, args) {
var res = [];
@lunaroyster
lunaroyster / Vector.js
Created November 25, 2017 19:37
A minimalist (amateur) implementation of 'Vector', along with cosineSimilarity
class Vector {
constructor(VectorArray) {
//TODO: Check things?
this._values = VectorArray;
}
toArray() {
return this._values;
}
get length() {
return this._values.length;