Skip to content

Instantly share code, notes, and snippets.

View kevinrobayna's full-sized avatar

Kevin Robayna kevinrobayna

View GitHub Profile
require 'sinatra/base'
require 'haml'
require 'coffee-script'
require 'sass'
class WebAppExample < Sinatra::Base
set :root, File.dirname(__FILE__)
#Needed for CoffeeScript and SCSS
@kevinrobayna
kevinrobayna / Gemfile
Last active August 29, 2015 13:58 — forked from crguezl/Gemfile
source :rubygems
gem 'sinatra'
gem 'json'
gem 'omniauth'
gem 'omniauth-oauth2'
gem 'omniauth-github'
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__)
gem 'thin'
%lex
%%
[\s\t\n\r] /** SKIP WHITESPACE */
<<EOF>> return 'EOF'
a return 'T_A';
b return 'T_B';
/lex
@kevinrobayna
kevinrobayna / RemoveAccentsDiacritics.rb
Created May 26, 2014 09:14
Remove all accents and diacritics from string in Ruby
# coding: utf-8
from = "ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž"
to = "AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz"
line = line.tr(from,to)
function add( x, y ) {
if ( y == 0 ) {
var g = function ( x ) {
return p ( arguments, 0 );
};
return g ( x );
}
else if ( y > 0 ) {
y --;
var h = function ( x, y, add_x_y ) {
function times( x, y ) {
if ( x == 0 || y == 0 ) {
return z ( x );
}
else if ( y == 1 ) {
var g = function ( x ) {
return p ( arguments, 0 );
};
return g ( x );
}
#!/bin/bash
# +----------------------------------------------------------------------+
# | |
# | Mount the root file system / with the option noatime |
# | |
# | By Philipp Klaus <http://blog.philippklaus.de> |
# | Tip found on <http://blogs.nullvision.com/?p=275> |
# | |
# +----------------------------------------------------------------------+
File folder = new File("your/path");
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("File " + listOfFiles[i].getName());
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
}
}
long start_time = System.nanoTime();
//whatever you want
long end_time = System.nanoTime();
double difference = (end_time - start_time)/1e6;