Skip to content

Instantly share code, notes, and snippets.

View devyn's full-sized avatar
👨‍💻
Nushell is really cool

Devyn Cairns devyn

👨‍💻
Nushell is really cool
View GitHub Profile
# This is an example of a shoes terminal
# Created by Devyn Cairns
Shoes.app do
background "#FFF"
@win = flow do
@header = para('shoes console', :family => 'monospace', :fill => "#000", :stroke => "#FFF", :align => 'center', :margin => 8)
para "\n"
@console = para('$ ', :family => 'monospace', :stroke => "#000")
@cursor = para(' ', :fill => "#FFF", :family => 'monospace')
@nodelete = 2
@devyn
devyn / foo.rb
Created November 2, 2008 03:22 — forked from febuiles/foo.rb
# fast way to include too many stylesheets
def include_stylesheets
sheets = %w(dropdown style calendar/red/style facebox)
sheets.collect{|sheet|stylesheet_link_tag(sheet)}.join
end
@devyn
devyn / quick-indexer.rb
Created November 11, 2008 23:57
a quick file indexer for ruby
# a quick file indexer for ruby
def checksum(file_loc)
sum = 0
File.open(file_loc){|f|f.each_byte{|b|sum^=b}}
sum
end
$index = []
def enter dir
(Dir.entries(dir) - %w(. ..)).each do |ent|
if File.directory? File.join(File.expand_path(dir), ent)
@devyn
devyn / redfs-fuse.rb
Created November 13, 2008 23:55
RedFS is a mountable block system (not working yet)
#!/usr/bin/env ruby
# RedFS (Fuse)
# RedFS is a mountable block system
# To make a RedFS virtual system, use the following shell command:
# $ dd if=/dev/zero of=(yourfile) bs=4096 count=(number of blocks)
# To run:
# # ./redfs-fuse.rb (yourfile) (mountpoint)
# or:
# $ sudo ./redfs-fuse.rb (yourfile) (mountpoint)
# Also, please note that if when you write a block and it is larger than 4096 bytes, RedFS will cut off at that point.
# DoughTracker, a GUI for creating goals of money.
require 'yaml'
class ::DTGoal
attr_accessor :name, :goal, :so_far
def initialize(name, goal)
@name, @goal = name, goal
@so_far = 0.0
end
def fraction
@so_far/@goal
# Shoes-IRB made by ~devyn
require 'irb'
Shoes.app do
background black
@p = para '', :family => 'monospace', :color => white
@sreader, @swriter = StringIO.new, StringIO.new
Thread.start do
@irb = IRB::Irb.new(nil, @sreader, @swriter)
loop do
require 'uri'
module CrumbleURL; extend self
def crumble_to_url c
c =~ /^([A-Za-z0-9_-]+)\((\d+)\) ([A-Za-z0-9_.-]+)/
uri = URI::Generic.build(:scheme => $1, :port => $2, :host => $3.split('.').reverse.join('.'))
if c =~ /> ([A-Za-z0-9()_.-^]+)/
uri.path = "/" + $1.split('.').collect{|pt|pt.gsub(/\(\d+\)$/){|o|'/'+o[1..-2]}.gsub("^", ".")}.join("/")
end
if c =~ /\{(.*)\}$/
uri.query = $1.gsub(": ", "=").gsub(", ", "&")
-module(dyndata).
-export([new/0, data_process/1, set_data/2, get_data/1, destroy/1, add/2, at/2]).
%%% Dynamic Data by ~devyn %%%
new() ->
spawn(dyndata, data_process, [[]]).
data_process(DynData) ->
receive
class ARF
attr :coords
def initialize map, follow, size, app
@map, @follow, @size, @app, @coords = (map.is_a?(Array) ? map : [map]), follow, size, app, [follow.left,follow.top]
@vx, @vy = 0,0 # velocity
animate_loop
end
def [](x,y)
@coords[0] += x
@coords[1] += y
#!/usr/bin/env ruby
require 'rubygems'
require 'json'
require 'uri'
require 'net/http'
$tw_user = "<twitter_username>"
$tw_pass = "<twitter_password>"
case ARGV[0]