Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
// Generates a graph that shows n levels of the Collatz Conjecture.
var reverseCollatz = function(r, max) {
function compute() {
var level = {1: 1},
results = {},
index = {};
for (var c=1; c<max; c++) {
var newlevel = {};
module.exports = function (properties) {
var object = Object.create(null)
if ((typeof properties !== 'undefined') &&
(properties !== null) &&
(typeof properties === 'object')) {
for (var property in properties) {
if (properties.hasOwnProperty(property)) {
object[property] = properties[property]
}
@jonathanmarvens
jonathanmarvens / gist:4d8ef268c0e65a0ce0ea
Created February 16, 2016 16:22 — forked from eevee/gist:55426e5856f5825317b1
adblock rules to hide mentions from people who don't follow you

Pop open "filter preferences" in adblock plus, and add the following rules to hide mentions from people who don't follow you (and who you don't follow).

For the interactions/notifications page:

twitter.com##.interaction-page [data-follows-you="false"][data-you-follow="false"]:not(.my-tweet)

For the mentions page:

twitter.com##.mentions-page [data-follows-you="false"][data-you-follow="false"]:not(.my-tweet)
const a = [4, 1, 9, 6, 5]
const b = [0, 3, 5, 2, 7]
const universe = new Set(a.concat(b))
const bSet = new Set(b)
let complement = new Set(Array.from(universe).filter((member) => ! bSet.has(member)))
@jonathanmarvens
jonathanmarvens / google_twunter_lol
Created February 8, 2016 10:25 — forked from jamiew/google_twunter_lol
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
function f(str)
local outer_env = _ENV
return (str:gsub("%b{}", function(block)
local code = block:match("{(.*)}")
local exp_env = {}
setmetatable(exp_env, { __index = function(_, k)
local stack_level = 5
@jonathanmarvens
jonathanmarvens / gist:28979ec94a978b930736
Created January 2, 2016 13:42 — forked from zliuva/gist:1084476
A minimal Mach-o x64 executable for OS X
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
;
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
/**
****************************************************************************
* Copyright 2015 Jonathan Barronville <jonathan@belairlabs.com> *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
[
{
"code": "AF",
"name": "Afghanistan"
},
{
"code": "AX",
"name": "Aland Islands"
},
{
@jonathanmarvens
jonathanmarvens / langoliers.rb
Last active August 29, 2015 14:26 — forked from robinsloan/langoliers.rb
Tweet delete script
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
# things you must configure
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder
TWITTER_USER = "your_twitter_username"