Skip to content

Instantly share code, notes, and snippets.

View jeremyroman's full-sized avatar

Jeremy Roman jeremyroman

View GitHub Profile
@jeremyroman
jeremyroman / mymodule.js
Created July 6, 2011 14:31
Example of CommonJS modules
var nextNumber = 0;
module.exports.getNumber = function() {
nextNumber += 1;
return nextNumber;
};
@jeremyroman
jeremyroman / sass_http.rb
Created July 28, 2011 15:54
An HTTP importer for Sass
# Additional caching and such might be helpful for performance.
# Sass's regeneration only on changed files should work as long as the server provides the Last-Modified header
require 'net/http'
require 'time'
require 'sass'
module Sass
module Importers
# Importer which issues HTTP requests
@jeremyroman
jeremyroman / gist:1239662
Created September 24, 2011 18:18
Java hello world
import java.lang.*;
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
@jeremyroman
jeremyroman / gist:1240690
Created September 25, 2011 15:02
Repetition
public class BananaMerchant {
private final BananaFactory bananaFactory;
private final ShippingAgent shippingAgent;
private final PricingBroker pricingBroker;
private final List<Banana> bananas;
private final Map<Integer, Customer> customerMap;
public BananaMerchant(
final BananaFactory bananaFactory,
final ShippingAgent shippingAgent,
#include <iostream>
#include <string>
#include <vector>
template <template <typename> class M>
class Monad {
public:
template <typename A, typename B, typename Function>
static M<B> monad_bind(M<A> in, Function function);
$ g++ -c monads.cc
monads.cc: In member function ‘lvector<B> Monad<lvector>::bind(lvector<A>, Function)’:
monads.cc:24: error: expected `;' before ‘it_a’
monads.cc:26: error: ‘it_a’ was not declared in this scope
monads.cc:28: error: expected `;' before ‘it_b’
monads.cc:28: error: ‘it_b’ was not declared in this scope
#include <string>
#include <vector>
@jeremyroman
jeremyroman / gist:1535904
Created December 29, 2011 19:52
Testing Rubinius::Generator
g = Rubinius::Generator.new
g.required_args = 1
g.total_args = 1
g.local_count = 1
g.set_line 1
g.push_local 0
g.ret
g.close
@jeremyroman
jeremyroman / gist:2012313
Created March 10, 2012 18:01
glomag sadness
(initramfs) lvm pvdisplay
--- Physical volume ---
PV Name /dev/sde2
VG Name bah
PV Size 148.11 GiB / not usable 355.50 KiB
Allocatable yes
PE Size 4.00 MiB
Total PE 37917
Free PE 37917
Allocated PE 0
(sdd, sde) -> md0/RAID0 -> vg0 (root, swap, tmp, caffeinetmp)
(sda, sdb) -> md1/RAID1 -> vg1 (caffeine)
(sdc2) -> vg2 (nothing)
(sdf2) -> bah (nothing)
sdc1: /boot
sdf1: /boot (deprecated)
bah: 148.11g
vg0: 931.52g
(define otherscene (scene (list ; lights
(light '(-100.0 150.0 400.0) '(0.7 0.7 0.7))
(light '(400.0 100.0 150.0) '(0.7 0.0 0.7)))
(list ; primitives
(sphere '(0.0 0.0 15.0) 3.0 mat1)
(sphere '(-3.0 -3.0 15.0) 1.0 mat1)
(sphere '(-5.0 -5.0 15.0) 1.0 mat1)
(sphere '( 7.0 7.0 15.0) 1.0 mat1)