Skip to content

Instantly share code, notes, and snippets.

View hsanchez's full-sized avatar
I may be slow to respond.

Huascar Sanchez hsanchez

I may be slow to respond.
View GitHub Profile
---
- :language: Perl
:user_id: sitaramc
:repository: gitolite
- :language: Perl
:user_id: petdance
:repository: ack
- :language: Perl
:user_id: rakudo
:repository: rakudo
@hsanchez
hsanchez / .gvimrc
Created December 7, 2011 10:32 — forked from stephencelis/.gvimrc
MacVim meets WriteRoom
" MacVim meets WriteRoom.
if has("autocmd")
augroup txt
au!
autocmd GUIEnter *.txt set nolist
autocmd GUIEnter *.txt set columns=80
autocmd GUIEnter *.txt set noruler
autocmd GUIEnter *.txt set nonumber
autocmd GUIEnter *.txt set linebreak
@hsanchez
hsanchez / classifier_hack.rb
Created February 1, 2012 22:49 — forked from barce/classifier_hack.rb
monkey patch for Array if using classifier gem
class Array
def sum(identity = 0, &block)
return identity unless size > 0
if block_given?
map(&block).sum
else
a = inject( nil ) { |sum,x| sum ? sum+x : x }
# Hack to remove the to_f error
a.is_a?(Array) ? a : a.to_f
@hsanchez
hsanchez / hunt-and-kill.rb
Created February 27, 2012 17:25 — forked from jamis/hunt-and-kill.rb
An implementation of the "Hunt and Kill" algorithm for generating mazes.
# --------------------------------------------------------------------
# An implementation of the "Hunt and Kill" algorithm. This is fairly
# similar to the recursive backtracking algorithm, except that there
# is no recursion, and it doesn't backtrack. :) The algorithm can
# get a little slow towards the end, where the "hunt" phase has to
# search over nearly the entire field to find a candidate cell, but
# it's guaranteed to finish (unlike Aldous-Broder and Wilson's), and
# it's still pretty fast.
# --------------------------------------------------------------------
@hsanchez
hsanchez / WebGL_Canvas_Texture_Text_Example.html
Created February 27, 2012 17:32 — forked from studioijeoma/WebGL_Canvas_Texture_Text_Example.html
Three.js WebGL Canvas Texture Text Example
<!doctype html>
<html>
<head>
<title>Three.js : WebGL Canvas Texture Text Example</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
body {
@hsanchez
hsanchez / perlin-noise-classical.js
Created March 12, 2012 16:25 — forked from banksean/perlin-noise-classical.js
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@hsanchez
hsanchez / jekyllmarkdown.rb
Created March 26, 2012 03:39 — forked from schinckel/jekyllmarkdown.rb
Jekyll renderer for Marked.app
#!/usr/bin/ruby
# Github-flavored markdown to HTML, in a command-line util.
#
# $ cat README.md | ./ghmarkdown.rb
#
# Notes:
#
# You will need to install Pygments for syntax coloring
#
# $ pip install pygments
@hsanchez
hsanchez / gfm.rb
Created March 26, 2012 03:39 — forked from peterhellberg/gfm.rb
GitHub Flavored Markdown parser for use with Jekyll and Marked.app
#!/usr/bin/env ruby
require 'rubygems'
require 'redcarpet'
require 'pygments.rb'
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, :lexer => language.to_sym, :options => {
:encoding => 'utf-8'
})
@hsanchez
hsanchez / Example.mini
Created April 2, 2012 16:19 — forked from kmizu/Example.mini
Toy language with parser combinators of scala, which is derived from Kishida-san's code. Original language has dynamic scope. But It has static scope and so-called lexical closure.
val factorial = (n) => {
if(n < 2) 1 else (n * factorial(n - 1));
};
println("factorial(3) = " + factorial(3));
def mkcounter(n) = () => {
n = n + 1;
n
};
val counter = mkcounter(6);
@hsanchez
hsanchez / Rakefile
Created April 5, 2012 01:09
LaTeX Building Rakefile
# encoding: utf-8
def config
# in this Rakefile we can allow that
$config ||= Hash.new
end
# main TeX file without extension
config['main'] = 'YourAwesomeTex'