Skip to content

Instantly share code, notes, and snippets.

View 53cr's full-sized avatar

Chromium 53 53cr

View GitHub Profile
rbx-1.0.0-rc2 > "not(false\n1)".to_ast.ascii_graph Not
@line: 2
@value: \
Block
@line: 1
@array: \
False
@line: 1
FixnumLiteral
@line: 2
import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int cases = in.nextInt();
String data;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int cases = in.nextInt();
Peak p;
Peak[] peaks = new Peak[cases];
~ % sudo gem1.9 install rubyosa burke@wi-open-436 (15:58)
Building native extensions. This could take a while...
ERROR: Error installing rubyosa:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby1.9 extconf.rb install rubyosa
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... no
checking for atan() in -lm... yes
(defun color-theme-sunburst ()
(interactive)
(color-theme-install
'(color-theme-sunburst
((background-color . "#000000")
(foreground-color . "#FFFFFF")
(cursor-color . "#DAD085"))
(default ((t (nil))))
(modeline ((t (:background "DarkRed" :foreground "white"
:box (:line-width 1 :style released-button)))))
;; The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
;; Find the sum of all the primes below two million.
(defn is-prime [n]
(loop [d (int (Math/sqrt n))]
(if (= d 1)
true
(if (= 0 (rem n d))
false
require 'benchmark'
str = "1 2 3 4-5 6 7 8-9"
Benchmark.bm do |bm|
bm.report("split: ") {10000.times do hash = Hash.new(0); str.split.each { |m| hash[m] += 1}; end }
bm.report("scan: (\\w+) ") { 10000.times do hash = Hash.new(0); str.scan(/\w+/m) { |m| hash[m] += 1} end }
bm.report("scan: (\w+(-\w+)?) ") { 10000.times do hash = Hash.new(0); str.scan(/(\w+(-\w+)?)/m) { |m| hash[m] += 1} end }
end
## Native environment tests - 1.8.7
require 'benchmark'
str = "1 2 3 4-5 6 7 8-9"
Benchmark.bm do |bm|
bm.report("split: ") {10000.times do hash = Hash.new(0); str.split.each { |m| hash[m] += 1}; end }
bm.report("scan: (\\w+) ") { 10000.times do hash = Hash.new(0); str.scan(/\w+/m) { |m| hash[m] += 1} end }
bm.report("scan: (\w+(-\w+)?) ") { 10000.times do hash = Hash.new(0); str.scan(/(\w+(-\w+)?)/m) { |m| hash[m] += 1} end }
end
## Native environment tests - 1.8.7
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
desc 'Minify javascript'
task :minify do
`rm -rf output/javascripts/tmp`
`cat output/javascripts/*.js | ruby lib/jsmin.rb > output/javascripts/tmp`
`rm -rf output/javascripts/*.js`
`mv output/javascripts/tmp output/javascripts/master.js`
end
# EOF