Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Crichton alexcrichton

View GitHub Profile
@alexcrichton
alexcrichton / base.rb
Created Oct 18, 2010
Basic new rails application template
View base.rb
remove_file 'README'
remove_file 'public/index.html'
remove_file 'public/favicon.ico'
remove_file 'public/images/rails.png'
remove_file 'public/javascripts/*.js'
remove_dir 'doc'
remove_dir 'test'
create_file 'public/javascripts/.gitkeep'
run 'cp config/database.yml config/database.yml.example'
View test.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>test</title>
<script src="http://code.jquery.com/jquery-1.4.3.js" type="text/javascript"></script>
<script src="http://github.com/alexcrichton/jquery-ujs/raw/master/src/rails.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
View CMU-CA-server-2.cer
-----BEGIN CERTIFICATE-----
MIIDCDCCAnGgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCVVMx
FTATBgNVBAgTDFBlbm5zeWx2YW5pYTETMBEGA1UEBxMKUGl0dHNidXJnaDEjMCEG
A1UEChMaQ2FybmVnaWUgTWVsbG9uIFVuaXZlcnNpdHkxGzAZBgNVBAsTEkNvbXB1
dGluZyBTZXJ2aWNlczEYMBYGA1UEAxMPQ01VIENBIHNlcnZlciAyMB4XDTA1MDUy
NTE3MDAwMFoXDTEwMDYwMTE3MDAwMFowgZUxCzAJBgNVBAYTAlVTMRUwEwYDVQQI
EwxQZW5uc3lsdmFuaWExEzARBgNVBAcTClBpdHRzYnVyZ2gxIzAhBgNVBAoTGkNh
cm5lZ2llIE1lbGxvbiBVbml2ZXJzaXR5MRswGQYDVQQLExJDb21wdXRpbmcgU2Vy
dmljZXMxGDAWBgNVBAMTD0NNVSBDQSBzZXJ2ZXIgMjCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEA4fw49b86f3n55VXq1Ygv1hv7q0kfl6FXBOCoE6liblW8cflD
View gist:2898500
Process: Hermes [10620]
Path: /Applications/Hermes.app/Contents/MacOS/Hermes
Identifier: com.alexcrichton.Hermes
Version: 1.1.4 (1400)
Code Type: X86-64 (Native)
Parent Process: launchd [123]
Date/Time: 2012-06-08 15:40:44.154 -0700
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
View gist:3744405
setpgid(0,0);
exec("${command}");
# I think the below comment is a little bit full of lies
#
# we need to do this because somehow sml manages to
# fork a second internal process that ignores direct
# kills of the child. instead we create a new process
# group and then send an INT process to the direct child
# which then passes a KILL onto every process in its new group.
die "exec failed";
View gist:4231084
<?php
require_once('scoring.php');
require_once('player.php');
require_once('wonders.php');
function res($type, $amt, $one) {
$ret = new Resource($one, false);
for ($i = 0; $i < $amt; $i++)
$ret->add($type);
View .gitconfig
[user]
email = alex@alexcrichton.com
name = Alex Crichton
[github]
user = alexcrichton
token = ...
[core]
excludesfile = ~/.gitignore
[branch]
autosetuprebase = always # 'git pull' defaults to rebase
View foo.rs
trait Foo {
static fn foo(int) -> @self;
}
struct A { a: int }
impl A: Foo {
static fn foo(a: int) -> @A { @A{a: a} }
}
struct B { b: int }
View foo.rs
struct Foo {
foo : &int,
}
impl Foo {
fn a(&mut self) {}
}
fn main() {
let mut l = Foo { foo: &4 };
View foo.rs
use core::hashmap::linear::LinearMap;
fn fun1() {
let mut map = LinearMap::new();
map.insert(1, 2);
// ok
let size;
size = *map.get(&1);
map.insert(2, size);
}
You can’t perform that action at this time.