Skip to content

Instantly share code, notes, and snippets.

@ezy023
ezy023 / reverse_and_palindrome_recursion.rb
Created April 26, 2013 01:28
Implement String#reverse and check for palindromes using recursive methods
def reverse(string)
return string if string.length <= 1
reverse(string[1..-1]) + string[0]
end
puts reverse("string")
puts reverse("racecar")
def palindrome(string)
puts string
require 'mathn'
# def time_logger(function)
# start = Time.now
# function
# puts "It took #{(Time.now - start)/60} minutes to run #{function}"
# end
# PROBLEM 2
# def fibonacci
# fib_array = [1,2]
<?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.html -->
<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 () {
$("form").submit(function(click) {
click.preventDefault();
var action = $(this).attr("action")
var roll = Math.floor(Math.random()*6)+1;
console.log("roll before ajax", roll);
// var method = $(this).attr("method")
$.post(action,{"value" : roll }, function(rod_name){
var roll_html = $(rod_name).find("#die").html();
@ezy023
ezy023 / index.html
Last active December 17, 2015 16:09 — 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>
@ezy023
ezy023 / zoo.js
Last active December 17, 2015 16:09 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal(name, num_legs){
this.num_legs = num_legs;
this.name = name
};
var Zoo = {
animals: [],
require 'csv'
# ["id", "first_name", "last_name", "email", "phone", "created_at"]
class Person
attr_reader :first_name, :last_name, :email
def initialize(attributes)
@id = attributes["id"]
@first_name = attributes["first_name"]
@last_name = attributes["last_name"]
@email = attributes["email"]
@ezy023
ezy023 / output
Last active December 25, 2015 06:59
The row string is 396240001
The col string is 000003000
The box string is 396240001
The all string is 396240001000003000396240001
The row string is 39624�001
The col string is 003000080
The box string is 39624�001
The all string is 39624�00100300008039624�001
The row string is 39624�501
The col string is 009401530
#!/bin/sh
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# Make dotfiles directory
# mkdir ~/Documents/dofiles
DIRECTORY="/Users/$USER/Documents/dotfiles"
if [ ! -d $DIRECTORY ]; then
mkdir $DIRECTORY
function refreshFeed(){
var linkToClick= document.getElementsByClassName("new-tweets-bar")[0]
if(linkToClick != undefined){
linkToClick.click()
}
}
setInterval(refreshFeed, 500)