Skip to content

Instantly share code, notes, and snippets.

View krainboltgreene's full-sized avatar
🏠
Working from home

Kurtis Rainbolt-Greene krainboltgreene

🏠
Working from home
View GitHub Profile
# `git init` or `git clone`, depending on if the url is provided
$ gim c[reate] repo[sitory] [url]
# Completely removes the .git directory
$ gim d[elete] repo[sitory]
# Creates a branch and switches to that branch.
$ gim c[reate] br[anch] [name] [--from=|-f base]
# Deletes a branch, with a warning if it's not merged in.
require 'ostruct'
module DOM
class Element
BLOCK_NAMES = %w[head title base link meta-equiv style script noscript body
section nav article aside h1 h2 h3 h4 h5 h6 hgroup header footer address
p hr pre blockquote ol ul li dl dt dd figure figcaption div iframe embed
object param video audio source track canvas map area table caption
colgroup col tbody thead tfoot tr td th form-charset fieldset legend label
input button select datalist optgroup option textarea keygen output
@krainboltgreene
krainboltgreene / forth.rb
Created January 15, 2012 18:45 — forked from perimosocordiae/forth.rb
A pure Ruby interpreter for Forth
#!/usr/bin/env ruby
# Return and remove the last value of the stack array
def pop
$stack.pop || raise(StackUnderflow)
end
# Add a expression to the stack
def push(expression)
$stack << expression
case
when public_api.any?(&:changed?) or public_api.any?(&:removed?)
version.major.succ!
when public_api.any?(&:new?) or private_api.any?(&:new_or_changed?)
version.minor.succ!
when public_api.any?(&:fixed?) or private_api.any?(&:fixed?)
version.patch.succ!
when documentation.any?(&:new_or_changed?) or tests.any?(&:new_or_changed?)
version.patch.succ!
end
class Person
include Intrinsic
property :name, String
property :email, String
property :age, Integer, default: 13
embeds :skills do
property :name
property :rank, Integer, default: 0
# An implementation of "FizzBuzz" in Dragon
0..100 each: n does: ->
if: N is_divisible? By: 15 then: -> output: "FizzBuzz"
if: N is_divisible? By: 3 then: -> output: "Fizz"
if: N is_divisible? By: 5 then: -> output: "Buzz"
else: -> N to: String
# While this looks semantically similar there's a lot going
# on here that should be explained! Lets go through it line by line:
# First we instantiate a range, where the floor is 0 and the roof is 100
require 'bundle/setup'
include Lifepad
compile_layout "layouts/*.slim" do
use Slim
end
compile "*.slim" do
use Slim

Shogun

Shogun is a light weight, and yet powerful, Ruby web application framework. It's robust design allows for distributed web applications that span multiple servers, databases, and APIs. What does that mean, though?

  • Shogun is a PAC architecture, the only one, and the unique architecture allows it to stay up even under the harshest conditions
  • Shogun as a framework is database, template, style, script, testing library, and even language agnostic (to a degree)
require 'coulda'
Feature 'Division' do
To 'avoid silly mistakes'
A 'cashier'
Should 'be able to calculate a fraction'
def calculator_on
Calculator.new
end
@krainboltgreene
krainboltgreene / gist:676052
Last active September 24, 2015 05:37
An example of draper UI
# This is some sample pseudo-code for a desktop application framework
#
# title: chitter.app - A twitter desktop app
# created: 2020.11.14-00:56:25
# author: Kurtis Rainbolt-Greene
require 'dapper-ui'
require 'looking-glass'
require 'twitter'