Skip to content

Instantly share code, notes, and snippets.

View jesjos's full-sized avatar

Jesper Josefsson jesjos

  • Mariehamn, Åland
View GitHub Profile
# Console dump
jesper-josefssons-macbook-pro:blog2 jesper$ rails server
=> Booting WEBrick
=> Rails 3.0.0.beta3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/session/cookie_store.rb:178:in `ensure_session_key': A key is required to write a cookie containing the session data. Use config.action_controller.session_store :cookie_store, { :key => "_myapp_session" } in config/application.rb (ArgumentError)
from /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/session/cookie_store.rb:88:in `initialize'
class Run {
public static void main(String [] args) {
Skipcheck skip = new Skipcheck(100000000);
skip.tester();
}
}
import java.util.ArrayList;
class Run {
public static void main (String[] args) {
FotbollsLag team1 = new FotbollsLag("BK Hejsan");
FotbollsLag team2 = new FotbollsLag("BK Nej");
FotbollsLag team3 = new FotbollsLag("BKKK");
@jesjos
jesjos / calendar.rb
Created October 17, 2010 21:42
model
class Calendar < ActiveRecord::Base
def self.get_rooms
c = Marshal.load(Calendar.last.cal_dump)
events = {}
c.events.each do |c|
if events.has_key? c.location
events[c.location].push(c.occurences.first)
else
events.store(c.location, Array[c.occurences.first])
end
HC1Mon Oct 11 09:00:00 +0200 2010Mon Oct 11 10:00:00 +0200 2010Mon Oct 11 13:15:00 +0200 2010Mon Oct 11 15:15:00 +0200 2010Tue Oct 12 08:00:00 +0200 2010Tue Oct 12 13:15:00 +0200 2010Wed Oct 13 08:00:00 +0200 2010Wed Oct 13 10:00:00 +0200 2010Wed Oct 13 13:15:00 +0200 2010Thu Oct 14 10:00:00 +0200 2010Thu Oct 14 13:15:00 +0200 2010Fri Oct 15 08:00:00 +0200 2010Sat Oct 16 08:00:00 +0200 2010Mon Oct 18 08:00:00 +0200 2010Tue Oct 19 08:00:00 +0200 2010Wed Oct 20 08:00:00 +0200 2010Thu Oct 21 08:00:00 +0200 2010Fri Oct 22 08:00:00 +0200 2010Sat Oct 23 08:00:00 +0200 2010Mon Oct 25 08:00:00 +0200 2010Mon Oct 25 10:00:00 +0200 2010Mon Oct 25 13:15:00 +0200 2010Mon Oct 25 15:15:00 +0200 2010Tue Oct 26 10:00:00 +0200 2010Wed Oct 27 08:00:00 +0200 2010Wed Oct 27 10:00:00 +0200 2010Wed Oct 27 13:15:00 +0200 2010Thu Oct 28 10:00:00 +0200 2010Thu Oct 28 13:15:00 +0200 2010Fri Oct 29 08:00:00 +0200 2010Fri Oct 29 13:15:00 +0200 2010HC2Mon Oct 11 10:00:00 +0200 2010Mon Oct 11 13:15:00 +0200 2010Tue Oct 12 10:00:00 +0200 20
@jesjos
jesjos / MMult.java
Created November 1, 2010 21:03
En matrismultiplikationsflärp
class MMult {
public static int[][] mult(int[][] a, int[][] b) {
int rows = a.length;
int elements = a[0].length;
int columns = b[0].length;
int[][] results = new int[rows][columns];
for (int n = 0; n < rows; n++) {
for (int m = 0; m < rows; m++) {
for (int i = 0; i < elements; i++) {
results[n][m] += a[n][i]*b[i][m];
# views/layouts/application.html.haml
!!!
%html
%head
%body
%nav#menu
Some content
#wrapper
%section#content
= yield
@jesjos
jesjos / gist:827639
Created February 15, 2011 15:18
Skitspråk
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
entity bcd59 is
port (
clk, ce, reset : in std_logic;
count : out std_logic_vector(7 downto 0);
ceo : out std_logic
) ;
process mainLoop {
MyTime t;
while (numberOfDrinks < Constants.MAX_DRINKS) {
t = new MyTime(clock.getTime().getValue());
drink = orderQueue(myOrder, t);
if (drink instanceof Landlord.Refusal) {
System.out.println("Customer says: I was refused!!!! I'll return later with an AK-47 and blast the place.");
break;
}
numberOfDrinks++;
@jesjos
jesjos / test.erl
Created February 26, 2011 11:35
Erlang test
main2() ->
spawn(callhome(self)),
receive
done ->
io:format("Done!",[])
end.
callhome(Main) ->
callhome(Main, 10).