View elapsedTime.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long start_time = System.nanoTime(); | |
//whatever you want | |
long end_time = System.nanoTime(); | |
double difference = (end_time - start_time)/1e6; |
View allFilesinFolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} | |
} |
View AlwaysMountRootFSWithNoatime_MacOSX.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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> | | |
# | | | |
# +----------------------------------------------------------------------+ |
View output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hola |
View times.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | |
} |
View add
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) { |
View RemoveAccentsDiacritics.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from = "ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž" | |
to = "AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz" | |
line = line.tr(from,to) |
View Grammar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%lex | |
%% | |
[\s\t\n\r] /** SKIP WHITESPACE */ | |
<<EOF>> return 'EOF' | |
a return 'T_A'; | |
b return 'T_B'; | |
/lex |
View Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
View WebAppExample.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'haml' | |
require 'coffee-script' | |
require 'sass' | |
class WebAppExample < Sinatra::Base | |
set :root, File.dirname(__FILE__) | |
#Needed for CoffeeScript and SCSS |