Skip to content

Instantly share code, notes, and snippets.

View Maumagnaguagno's full-sized avatar
〽️
Curiouser and curiouser!

Mau Magnaguagno Maumagnaguagno

〽️
Curiouser and curiouser!
View GitHub Profile
@jamis
jamis / recursive-division.rb
Created January 1, 2011 03:03
An implementation of the "Recursive Division" algorithm for maze generation.
# --------------------------------------------------------------------
# An implementation of the "Recursive Division" algorithm. This is a
# kind of fractal maze algorithm, recursively dividing the maze into
# smaller and smaller cells. This algorithm stops at the integer
# boundary, but theoretically the algorithm could continue infinitely
# to smaller and smaller scales.
#
# Note that this algorithm is implemented as a "wall adder", rather
# than a "passage carver", so the meaning of the bits in each cell
# is reversed: instead of the S bit (for instance) meaning "a passage
@practicingruby
practicingruby / bmp_reader.rb
Last active January 17, 2019 12:28
bmp_reader.rb
# coding: binary
class BMP
class Reader
PIXEL_ARRAY_OFFSET = 54
BITS_PER_PIXEL = 24
DIB_HEADER_SIZE = 40
def initialize(bmp_filename)
File.open(bmp_filename, "rb") do |file|
@acook
acook / keypress.rb
Created December 2, 2012 18:42
Read keypresses from user in terminal, including arrow keys using pure Ruby. This has since been folded into a much more robust gem called Remedy. https://rubygems.org/gems/remedy & https://github.com/acook/remedy
require 'io/console'
# Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char
STDIN.echo = false
STDIN.raw!
input = STDIN.getc.chr
if input == "\e" then
input << STDIN.read_nonblock(3) rescue nil
@noeldelgado
noeldelgado / github-graph-colours-changer.js
Last active March 8, 2020 23:05
Copy and paste the code on your github profile page to change the graph colours... (DevTools » Console)
// var GH = ['#EEEEEE', '#D6E685', '#8CC665', '#44A340', '#1E6823']; /* previous GH colors */
var GH = ['#EBEDF0', '#C6E48B', '#7BC96F', '#239A3B', '#196127'];
var CO = ['#EF4B4D', '#F89B47', '#FAEA20', '#7DC242', '#5D94CE', '#855CA7'];
var graph = document.getElementsByClassName('js-calendar-graph-svg')[0];
var days = [].slice.call(graph.getElementsByTagName('rect'), 0);
days.forEach(function(rect) {
switch(rect.getAttribute('fill').toUpperCase()) {
case GH[0]: rect.setAttribute('fill', CO[2]); break; // yellow
@Maumagnaguagno
Maumagnaguagno / .travis.yml
Last active February 18, 2020 00:02
Make Travis-CI push files to other repositories for you when tests pass
language: ruby
rvm:
- 2.0.0
env:
global:
- USER="username"
- EMAIL="[email protected]"
- REPO="name of target repo"
- FILES="README.md foo.txt bar.txt"
- GH_REPO="github.com/${USER}/${REPO}.git"

Ace

Ace PDDL

define(function(require, exports, module) {
  "use strict";
  var oop = require("../lib/oop");
  var PDDLHighlightRules = function() {
 var keywordMapper = this.createKeywordMapper({
@bbugh
bbugh / results.txt
Created March 8, 2018 16:04
Benchmarking for checking if one array contains another in Ruby
Warming up --------------------------------------
subtract 233.432k i/100ms # higher is better
bitwise & == 164.352k i/100ms
bitwise & size 218.548k i/100ms
bitwise & [] 200.794k i/100ms
contains_all 74.648k i/100ms
contains_all_count 112.634k i/100ms
set 19.238k i/100ms
set cached 194.675k i/100ms
all? include? 144.048k i/100ms