Skip to content

Instantly share code, notes, and snippets.

@usure
usure / blog.rb
Last active December 31, 2015 00:09
it works
#!/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
require 'fileutils'
require 'optparse'
require 'redcarpet'
current_time = Time.now
@pdir = "posts"
@output = "/var/www/blog/posts"
@template = "<center>Title:
<br>Date: **#{current_time}**
</center>"
@usure
usure / stack.lisp
Created January 13, 2014 04:18
A stack in common lisp.
(defparameter *stack*
(list 0))
(defun push-to-stack (&rest args)
"This pushes any number of arguments to the stack."
(dolist (arg args)
(push arg *stack*)
(print "ok")))
(defun pop-stack (&rest args)

Keybase proof

I hereby claim:

  • I am theshadowfog on github.
  • I am tinsef (https://keybase.io/tinsef) on keybase.
  • I have a public key whose fingerprint is CD9C 0E14 5EB5 69AA 8DC4 05A7 4BD5 F707 EFCC 6E2C

To claim this, I am signing this object:

use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
break;
}
}
@usure
usure / f.rb
Last active August 29, 2015 14:27 — forked from deadprogram/forth.rb
Forth interpreter in 64 lines of Ruby
#!/usr/bin/env ruby
require 'pp'
def pop; $stack.pop || raise(StackUnderflow); end
def push(expression); $stack << expression; end
def unary; -> { push(yield pop) }; end
def binary; -> { push(yield pop, pop) }; end
def unary_boolean; -> { push(if yield pop then 1 else 0 end) }; end
def binary_boolean; -> { push(if yield pop, pop then 1 else 0 end) }; end
def functions; -> { push(yield pop, pop)}; end
@usure
usure / stackr.rb
Last active August 29, 2015 14:27
stack lang
#!/usr/bin/env ruby
def push(element); $stack << element; end
def pop; $stack.pop end
$stack = []
$dictionary = {
'.' => -> { puts(pop) },
'..' => -> { puts($stack) },
'.,' => -> { pp($dictionary)},