Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry session
implicit class StringOps(s: String) { | |
val one = { println("one"); "one" } | |
val two = { println("two"); "two" } | |
lazy val three = { println("three"); "value" } | |
} | |
scala> "asdf".three | |
one |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionpackage com.collidermodular.util; | |
public class Timer { | |
private final double samplesPerMs; | |
private final Runnable runnable; | |
private double duration; | |
private double sampleCounter; | |
private double targetSampleCount; | |
private boolean active; |
package com.collidermodular.core; | |
public interface Host { | |
public double getSampleRate(); | |
public double getSamplesPerMs(); | |
public double getMsPerSample(); | |
public double getTempo(); | |
} | |
public interface ValueSource { |
// Based on the "3.3 Naive lowpass filter" 1-pole filter from: | |
// https://www.native-instruments.com/fileadmin/ni_media/downloads/pdf/VAFilterDesign_2.1.2.pdf | |
// https://www.youtube.com/watch?v=zPzCLqkQnr0 | |
class OnePoleLowPass { | |
private double cutOff; // unit: rads per sample | |
private double z = 0.0; | |
final double samplesPerSec = Values.SamplesPerMs * 1000; | |
final double twoPi = 2 * Math.PI; |
# | |
# A python module to implement recursive search/copy of files | |
# | |
import datetime | |
import shutil | |
import os | |
import re | |
class DirSearch(object): |
def fizzbuzz (start, end): | |
if start % 15 == 0: | |
print 'fizzbuzz' | |
elif start % 3 == 0: | |
print 'fizz' | |
elif start % 5 == 0: | |
print 'buzz' | |
else: | |
print start | |
class A | |
@value = "a" | |
def self.print | |
puts @value | |
end | |
end | |
class B < A | |
@value = "b" |
module.exports = { | |
A: { | |
hello: function() { | |
return 'hello'; | |
} | |
} | |
} |
// DEMO CODE | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
def time[A](label: String, block: => Future[A]) = { | |
val t0 = System.nanoTime() | |
block.onComplete { | |
case _ => { | |
val t1 = System.nanoTime() |