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
@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'
require "rubygems"
require "rake"
require "pathname"
require "rexml/document"
manifest = REXML::Document.new(File.read("AndroidManifest.xml"))
PACKAGE = manifest.elements["/manifest/@package"].value
NAME = manifest.elements["/manifest/application/activity/@android:name"].value
@hsanchez
hsanchez / undelaying_console.sh
Created April 9, 2012 03:02 — forked from weldyss/undelaying_console.sh
this is a command to undelaying launch mac console
sudo rm -rf /private/var/log/asl*
@hsanchez
hsanchez / example.html
Created April 11, 2012 03:38 — forked from edersohe/example.html
short plugin that implement vertical buttonset for radio buttons and checkboxes with jquery ui
<html>
<head>
<title>Test</title>
<link rel="stylesheet" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/start/jquery-ui.css"></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script>
<script src="jquery.myplugin.js"></script>
<script>
$(document).ready(function(){
//call plugin
@hsanchez
hsanchez / example.html
Created April 11, 2012 03:40 — forked from aziraphale/example.html
Short plugin that implements a vertical buttonset for radio buttons, checkboxes and button elements with jQuery UI (this fork also introduces correct plugin behaviour, re: collections/chainability)
<html>
<head>
<title>Test</title>
<link rel="stylesheet" media="all" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/themes/start/jquery-ui.css"></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script>
<script src="jquery.myplugin.js"></script>
<script>
$(document).ready(function(){
//call plugin
@hsanchez
hsanchez / tinyjson.js
Created April 15, 2012 02:04 — forked from antimatter15/tinyjson.js
json encoding engine that can encode objects to json
encode = function(obj){
//simple partial JSON encoder implementation
if(window.JSON && JSON.stringify) return JSON.stringify(obj);
var enc = arguments.callee; //for purposes of recursion
if(typeof obj == "boolean" || typeof obj == "number"){
return obj+'' //should work...
}else if(typeof obj == "string"){
//a large portion of this is stolen from Douglas Crockford's json2.js
return '"'+
TEX_FILES = FileList["*.tex", "figures/*", "*.bib", "*.cls"]
MAIN = "thesis" # name of main file without .tex suffix
MAIN_TEX = "#{MAIN}.tex"
OUT_PDF = "#{MAIN}.pdf"
file OUT_PDF => TEX_FILES do
%x{pdflatex -interaction=batchmode #{MAIN_TEX} >/dev/null 2>&1}
%x{makeindex #{MAIN} >/dev/null 2>&1}
%x{bibtex #{MAIN} >/dev/null 2>&1}
%x{pdflatex -interaction=batchmode #{MAIN_TEX} >/dev/null 2>&1}
# Rakefile for building tex file
require "rake/clean"
BASE = "documentname"
TYPE = ".tex"
OUT = ".pdf"
TEXFILE = FileList[BASE+TYPE]
OUTFILE = FileList[BASE+OUT]
BIBTEXCMD = "bibtex"
@hsanchez
hsanchez / gist:2495431
Created April 26, 2012 03:18 — forked from joevandyk/gist:1398026
packer.rb
# Problem:
#
# I have a number of items that need to be shipped.
# Each item is less than one pound.
# Each shipment can contain a maximum of one pound of items.
# How can I efficiently pack the packages?
class BoxContainer
attr_reader :boxes
@hsanchez
hsanchez / RaphaelJSShapeDrawingApp.html
Created May 9, 2012 07:54 — forked from kaylarose/RaphaelJSShapeDrawingApp.html
A Simple Vector Shape Drawing App with RaphaelJS and jQuery
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script src="http://yandex.st/raphael/1.5.2/raphael.min.js"></script>
<script>
/**
* A Simple Vector Shape Drawing App with RaphaelJS and jQuery
* copyright 2010 Kayla Rose Martin - Licensed under the MIT license
* Inspired by http://stackoverflow.com/questions/3582344/draw-a-connection-line-in-raphaeljs
**/