Skip to content

Instantly share code, notes, and snippets.

@alexhawkins
alexhawkins / nativeJavaScript.js
Last active April 28, 2024 08:52
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
@staltz
staltz / introrx.md
Last active May 2, 2024 12:31
The introduction to Reactive Programming you've been missing
@crmaxx
crmaxx / backup_brew.rb
Created November 30, 2013 01:40
backup installed brew packages
brew list > brew_list_tmp.txt
for each brew_list_tmp.txt do |pkg|
brew info pkg
get install string from "Built from source with:"
add "brew install #{pkg} #{params}" to brew_list.txt
end
@mudge
mudge / eventemitter.js
Last active April 29, 2024 07:48
A very simple EventEmitter in pure JavaScript (suitable for both node.js and browsers).
/* Polyfill indexOf. */
var indexOf;
if (typeof Array.prototype.indexOf === 'function') {
indexOf = function (haystack, needle) {
return haystack.indexOf(needle);
};
} else {
indexOf = function (haystack, needle) {
var i = 0, length = haystack.length, idx = -1, found = false;