Skip to content

Instantly share code, notes, and snippets.

View bitoiu's full-sized avatar

Vitor Monteiro bitoiu

View GitHub Profile
@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);
@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 / 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 / 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 / Gemfile
Last active August 29, 2015 14:26
Audit Requirements
source 'https://rubygems.org'
gem 'octokit'
@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 / self-signed-wildcard-cert-for-ghes.md
Last active September 19, 2023 09:37
Self-Signed Wildcard certificate with SAN using openssl / SSL

Copy the default template of openssl.cnf to a writable location.

cp /System/Library/OpenSSL/openssl.cnf src

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section

@bitoiu
bitoiu / GithubPullRequestDeficiencies.md
Created October 23, 2015 15:55 — forked from skingsland/GithubPullRequestDeficiencies.md
Reasons why Crucible/Fisheye is better than Github (Enterprise) Pull Requests for reviewing code

GENERAL:

  • You can't include commits from different repos in a single code review using github pull requests, whereas you can with Crucible code reviews.
  • It's risky to use a pull request for code that isn't ready to be merged yet. What if someone doesn't see the "DON'T MERGE" comment/title, and clicks the big green merge button?

VIEWING:

  • You can't adjust the line width in which files are displayed, even if you make your browser window wider than the page. Some XML/HTML content extends well past 80 characters.
    • There are numerous Chrome extensions which purport to provide this feature, but I haven't been able to get any of them to work for gh:e.
  • You can't choose to ignore white space, so if a change involved indenting a lot of lines, you'll have a hard time figuring out what changed. In Crucible, you can choose to ignore white space.
  • You can't see the full file name, if the file name and path are longer than ~70 characters, and the HTML element that contains the file name is absolutely sized so y
@bitoiu
bitoiu / lunch-options.md
Last active May 2, 2017 19:13
Stonehouse Vitor Monteiro: 12th December Lunch time
Name Starter Main Pudding
Nuno Partridge & pheasant terrine Baked Cod Fillet Banoffee pie
Fiona Partridge & pheasant terrine Baked Cod Fillet Jude's ice cream & sorbet
Nick Soup Roast Turkey Sticky Toffee Pudding
Sophonn Partridge & pheasant terrine Rib eye steak with salad and peppercorn sauce Banoffee Pie
Peter Partridge & pheasant terrine Rib eye steak with salad and peppercorn sauce Banoffee pie
Vitor Partridge & pheasant terrine Porcini Mushroom and Mascarpone Risotto Banoffee Pie
Bianca Partridge & pheasant terrin
@bitoiu
bitoiu / template.sh
Created December 30, 2015 18:19
Bash GitHub Enterprise setup
echo "Configuring GitHub Enterprise"
ghehost=`terraform output ghehost`
ghepass=`terraform output ghehost-admin-password`
gheport=8443
echo "Checking for GitHub Enterprise availability..."
for i in `seq 1 100`;
do