Skip to content

Instantly share code, notes, and snippets.

$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@Stephenitis
Stephenitis / gist:5538949
Created May 8, 2013 08:04
self join many to many
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, http://code.google.com/p/wwwsqldesigner/ -->
<!-- Active URL: http://socrates.devbootcamp.com/sql -->
<sql>
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" re="INT" quote=""/>
<type label="Decimal" length="1" sql="DECIMAL" re="DEC" quote=""/>
<type label="Single precision" length="0" sql="FLOAT" quote=""/>
<type label="Double precision" length="0" sql="DOUBLE" re="DOUBLE" quote=""/>
$(document).ready( function() {
setInterval(function(){
$(".frames").animate({
marginLeft: '-=100%'
},1000, function(){
$(this).find("li:last").after($(this).find("li:first"));
$(this).css({marginLeft:0});
})
},30);
});
@Stephenitis
Stephenitis / zoo.js
Last active December 16, 2015 22:09 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, legs){
this.name = name,
this.legs = legs
}
Animal.prototype = {
identify: function(){
@Stephenitis
Stephenitis / index.html
Created May 2, 2013 18:51 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>

Instructions:

  1. Download this application skeleton.
  2. Convert the app to use AJAX.
  3. Add any files you changed to your gist and submit your code.
@Stephenitis
Stephenitis / image_scrape_3000.rb
Created April 18, 2013 21:48
Stephen's home built image scrapper.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'uri'
puts "what website would you like to scrape?"
link = gets.chomp
URL = link

"SOLID Object-Oriented Design" by Sandi Metz @ GoRuCo 2009

Date: May 30, 2009

Video on confreaks.net

Notes

  • Design is all about dependencies
  • If you refer to something, you depend on it.
@Stephenitis
Stephenitis / Sudoku Columns Rows From String.rb
Last active December 15, 2015 15:09
sudoku columns and rows from a intial input(data) of a string or array of a Sudoku problem. testing the regex, use of instance variables
class SudokuBoard
attr_reader :rows, :columns, :data
attr_writer :rows, :columns, :data
def initialize(data)
if (data.respond_to? :join)
@data = data.join
else # If argument looks like an array of lines
@data = data
end