Skip to content

Instantly share code, notes, and snippets.

View clamstew's full-sized avatar
🤷

Clay Stewart clamstew

🤷
View GitHub Profile
@clamstew
clamstew / gist:6595483
Last active December 23, 2015 06:39
Gamble in JSON
{
"firstName": "Daniel",
"lastName": "McAdams",
"age": 307.69448,
"address": [{
"streetAddress": "2101 E 20th Street",
"city": "Austin",
"state": "TX",
"postalCode": 78722
}, {
def initialize (args={:event_time, :deadline, :event_name, :event_location, :minimum_attendees, :maximum_attendees, :creator_name, :phone, :email, :invitees})
@required = args.fetch(:event_time, :deadline, :minimum_attendees) # .fetch will throw an error if key doesn't exist in Hash
@optional = args[:creator, :event_name, :event_location, :attendees, :maximum_attendees] # simple access returns nil if key isn't set--no exception raised
end
@clamstew
clamstew / .gitignore
Last active December 24, 2015 02:19
Hartl's augmented .gitignore file from railstutorial.org
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
@clamstew
clamstew / gist:7042573
Created October 18, 2013 14:42
Jeff Felchner's dotfiles that has his shortcuts for git
[core]
quotepath = false
editor = vim -f
whitespace = trailing-space,space-before-tab
[branch]
autosetupmerge = false
autosetuprebase = remote
[difftool "araxis2way"]
cmd = compare -wait -2 "$LOCAL" "$REMOTE" "$MERGED"
[mergetool "araxis2way"]
@clamstew
clamstew / gist:7199992
Created October 28, 2013 16:25
Using staby lambda to put scope on the model
class Task < ActiveRecord::Base
belongs_to :project
belongs_to :employee
scope :complete, ->{ where(complete: true) }
scope :incomplete, ->{ where(complete: false) }
end
@clamstew
clamstew / Eterna Bootstrap
Created November 14, 2013 14:04
Full example of using bootstrap to quickly mockup eterna example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Eterna | Think of anything right now</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" />
<!-- put in font awesome -->
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
@clamstew
clamstew / Eterna Boostrap
Created November 14, 2013 14:06
Eterna Boostrap full example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Eterna | Think of anything right now</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" />
<!-- put in font awesome -->
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
@clamstew
clamstew / javascript_callback_functions.md
Last active December 30, 2015 06:59
What Are Javascript Callback Functions? An introductory blog post that first goes over 'Functions as Arguments' then how to use those as call back functions in both javascript and jQuery. by @taylor-smith and @clamstew

#What Are Javascript Callback Functions?

###Functions as Arguments

By now it should be clear that we can pass variables and objects into Javascript functions as arguments. For example, given:

// assign the string "Bob" to a variable 'name'
var name = "Bob";
// assign a function that returns a phrase as uppercase string
<div class="off-canvas-wrap">
<div class="inner-wrap">
<nav class="tab-bar">
<section class="left-small">
<a class="left-off-canvas-toggle menu-icon" ><span></span></a>
</section>
<%= render 'layouts/mobile_menu_btn' %>
<section class="middle tab-bar-section" style="">
<div style="width: 100%; text-align: left; margin-left: 0em;"><span style="font-weight: 800; font-size: 1.5em;">MAKER</span><span><%= image_tag "course/logo.png", {class: "logo", alt: "Logo", style: "margin: 0px 2px; margin-bottom: 10px;width: 30px"} %></span><span style="font-weight: 300; font-size: 1.5em;">SQUARE</span></div>
[
{
"sha": "a26394d7481d439e41f18b5d2efd08f64daaa5d4",
"commit": {
"author": {
"name": "Xavier Noria",
"email": "fxn@hashref.com",
"date": "2014-02-19T16:53:13Z"
},
"committer": {