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
extern crate sync; | |
extern crate collections; | |
use std::comm::Chan; | |
use std::mem::size_of_val; | |
use std::io::{ChanWriter,PortReader}; | |
use collections::hashmap::HashMap; | |
use std::task::try; | |
use sync::RWArc; |
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
extern crate libc; | |
extern crate native; | |
use libc::{c_short, c_int}; | |
mod linux { | |
use native::io::file::FileDesc; | |
use libc::c_int; | |
pub fn socketpair(domain: int, type_: int, protocol: int) -> Result<(FileDesc, FileDesc), int> { |
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
int apply(int (*func)(int), int x) { | |
return func(x); | |
} |
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
extern crate libc; | |
use libc::{c_short, c_int, c_void, ssize_t, size_t}; | |
use std::thread; | |
mod linux { | |
use std::os::unix::io::RawFd; | |
use libc::c_int; | |
pub fn socketpair(domain: i32, type_: i32, protocol: i32) -> Result<(RawFd, RawFd), i32> { |
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
#!/usr/bin/env python | |
# migrated from java code: | |
# https://github.com/KEOpenSource/EllipsoidFit/blob/master/EllipsoidFit/src/ellipsoidFit/FitPoints.java | |
import numpy as np | |
from numpy.linalg import svd, pinv, eig | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import pyplot as plt | |
def solveSystem(points): |
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
Started POST "/receive/users/909b3184e114a37e/" for 127.0.0.1 at Mon Oct 10 21:46:10 +0200 2011 pid=32321 time=1318275970 | |
SQL (0.2ms) BEGIN pid=32321 time=1318275971 | |
SQL (0.2ms) COMMIT pid=32321 time=1318275971 | |
Processing by PublicsController#receive as pid=32321 time=1318275971 | |
Parameters: {"xml"=>"[FILTERED]", "guid"=>"909b3184e114a37e"} pid=32321 time=1318275971 | |
SQL (1.1ms) SHOW TABLES pid=32321 time=1318275971 | |
Person Load (0.2ms) SELECT `people`.* FROM `people` WHERE `people`.`guid` = '909b3184e114a37e' LIMIT 1 pid=32321 time=1318275972 | |
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 LIMIT 1 pid=32321 time=1318275972 | |
Rendered text template (0.0ms) pid=32321 time=1318275972 | |
Completed 202 Accepted in 661ms (Views: 2.8ms | ActiveRecord: 2.0ms) pid=32321 time=1318275972 |
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
Started POST "/receive/users/88454cd3db1d8887/" for 127.0.0.1 at Wed Sep 28 00:41:20 +0200 2011 pid=28783 time=1317163280 | |
SQL (0.2ms) BEGIN pid=28783 time=1317163281 | |
SQL (0.1ms) COMMIT pid=28783 time=1317163281 | |
Processing by PublicsController#receive as pid=28783 time=1317163283 | |
Parameters: {"xml"=>"++++%3C%3Fxml+version%3D%271.0%27+encoding%3D%27UTF-8%27%3F%3E%0A++++%3Cdiaspora+xmlns%3D%22https%3A%2F%2Fjoindiaspora.com%2Fprotocol%22+xmlns%3Ame%3D%22http%3A%2F%2Fsalmon-protocol.org%2Fns%2Fmagic-env%22%3E%0A++++++++++++++%3Cencrypted_header%3E%0A++++++++++eyJjaXBoZXJ0ZXh0IjoiRmRnUFNsQ0VZV0lieDdwenVrRGFyeWJVRUN1YWJ2SjM1RU1DN0dXKzFyYXlGNVludXljSFc5UjJadnpBVFNXeFpWcVpUbVJnR01uTmkzWG9MdTFKSW1iTU9ESXptN3MvTS9Wdk5KNEJ3S1VUbXp3ME9zRmFJNWRJbW9YMUwwMStCSTh5Zjk4QnBjOXVJb21UdXRJVHhXSjBtNVNKMGJuNEdhYm5BV1NTUDNMcHNMMXNjUG14Ri9MTjNmTmI0aE02M2ZwTkI1aVM0OVhrZWdaQVJzZjZEYWVmTGZLVGpZRnlhc3l3MG5ueno5ZW9saW9XR3NkczhjalJYcU02QnJ3cnhaTXd3czh5QWV4aTRpNUFvdjE0Tmc9PSIsImFlc19rZXkiOiJsWUtNZ1RwdWNSenE0NmplV1o4UXpnUG5W |
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
module M0 | |
def foo | |
puts 'M2::foo' | |
end | |
end | |
module M1 | |
include M0 | |
def self.included(model) |
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
class MovePhotosToTheirOwnTable < ActiveRecord::Migration | |
def self.up | |
# create new table to which we can move all records from 'posts' table with type=='Photo' | |
create_table "photos", :force => true do |t| | |
t.integer "author_id", :null => false | |
t.boolean "public", :default => false, :null => false | |
t.string "diaspora_handle" | |
t.string "guid", :null => false | |
t.boolean "pending", :default => false, :null => false | |
t.text "text" |
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
class CommentAnything < ActiveRecord::Migration | |
def self.up | |
# before renaming the post_id column, we have to remove the corresponding indices and foreign keys | |
remove_foreign_key :comments, :posts | |
remove_index :comments, :post_id | |
# make comments able to refer to any table | |
# so the name post_id does not make sense anymore, since we could also refer to a different table | |
# call it commentable_id as a generic reference to a foreign key | |
# store the table that commentable_id refers to in commentable_type |
OlderNewer