Skip to content

Instantly share code, notes, and snippets.

View bitoiu's full-sized avatar

Vitor Monteiro bitoiu

View GitHub Profile
@bitoiu
bitoiu / background.html
Last active October 28, 2015 16:15 — forked from srsudar/background.html
Pasting from the system clipboard using a Chrome extension.
<!DOCTYPE html>
<html>
<head>
<script src="background.js"></script>
</head>
<body>
<textarea id="sandbox"></textarea>
</body>
@bitoiu
bitoiu / Gemfile
Last active August 29, 2015 14:26
Audit Requirements
source 'https://rubygems.org'
gem 'octokit'
@bitoiu
bitoiu / mentions.js
Last active August 29, 2015 14:22
Adds GitHub idle mentions on the participants tab
(function() {
"use strict"
$.fn.reduce = [].reduce;
var $comments = $('div.issues-listing')
var getMentioned = function () {
@bitoiu
bitoiu / missionariesAndCannibals
Last active January 6, 2020 19:19
Prolog: Missionaries and Cannibals
% Run missionaries(((3,3),(0,0),1),[],Path).
validMove(Position, Visited):-
notMember(Position,Visited),
positiveCount(Position),
noEatingAnyone(Position).
positiveCount(((LeftCannibals,LeftMissionaries), (RightCannibals,RightMissionaries),_)):-
LeftCannibals >=0,
LeftMissionaries >=0,
@bitoiu
bitoiu / perm6.prolog
Created January 15, 2014 17:14
prolog permutations of 1 and 2 that add to 6
perm6([1],5).
perm6([2],4).
perm6([1|T], Current) :- Current < 6 , Next is Current +1, perm6(T, Next).
perm6([2|T], Current) :- Current < 6 , Next is Current +2, perm6(T, Next).
perm62(_, Current) :- Current >= 6, !.
perm62([1],5).
perm62([2],4).
perm62([1|T], Current) :- Next is Current +1, perm6(T, Next).
perm62([2|T], Current) :- Next is Current +2, perm6(T, Next).
@bitoiu
bitoiu / rebind.js
Created October 23, 2013 15:51
d3js rebind playground
function rebind(target, source) {
var i = 1, n = arguments.length, method
hile (++i < n) target[method = arguments[i]] = innerRebind(target, source, source[method])
return target
}
function innerRebind(target, source, method) {
return function() {
if ( isFunctionA(source[method])) {
var value = method.apply(source, arguments);