Skip to content

Instantly share code, notes, and snippets.

View SamSamskies's full-sized avatar
🚀
vamos

Sam Samskies SamSamskies

🚀
vamos
  • Various
View GitHub Profile
@SamSamskies
SamSamskies / ruby_joke_041213
Last active December 16, 2015 04:19
My Ruby Joke of the Day 4/12/13
bar = ["beer"] * 50
bar.inject([]) { |my_mouth, beer| my_mouth << beer }
@SamSamskies
SamSamskies / blank_line_stripper.rb
Last active December 16, 2015 05:08
I created a ruby one liner to delete all blank lines from a text file and store each line in an array.
#returns an array filled with each non-blank line from the file as elements.
File.read(file).squeeze("\n").split("\n")
@SamSamskies
SamSamskies / index.html
Last active December 16, 2015 22: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>
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
// DRIVER CODE: Do **NOT** change anything below this point. Your task is to implement code above to make this work.
//------------------------------------------------------------------------------------------------------------------
var express = require('express')
, http = require('http')
, path = require('path')
, fs = require('fs')
, pg = require('pg')
, orm = require('orm')
, routes = require('./routes')
, discover = require('./routes/discover')
, campgrounds = require('./routes/campgrounds')
@SamSamskies
SamSamskies / rails_jquery_ajax.md
Last active October 5, 2017 17:51
Rails: jQuery & AJAX Tutorial

jQuery and jQuery-ujs

When using Rails 3.0 and later we already get jquery-rails for free. Look in the gemfile and you'll see:

gem "jquery-rails"

You can view the full documentation here: source: https://github.com/indirect/jquery-rails

If you take a look in APP_DIR/app/assets/javascripts/application.js, you'll notice the following lines of code:

Testing Tips & Tricks

Run a single test

In a large application, running all the tests at once using rake spec can make it difficult to check the output of the test you're working on. Especially if you have many failing or pending tests. Run a single test by running rspec:

rspec spec/models/account.rb

You can be even more specific and run a specific example from a test file. For example, given the following tests:

11: describe "#deposit!" do
@SamSamskies
SamSamskies / app.js
Created May 21, 2013 01:29
Behavior Drill: Grocery List
function List(listType) {
this.items = [];
this.total = 0;
this.listType = listType;
this.init = function() {
if (this.listType === 'store') {
this.makeItemsDraggable();
this.populateItems();
} else {
@SamSamskies
SamSamskies / app.css
Last active January 17, 2020 20:08
Google geocode example
#myMap {
width: 800px;
height: 500px;
}
@SamSamskies
SamSamskies / html5-boilerplate.html
Created August 31, 2013 04:40
Simplest HTML5 Boilerplate template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Blank HTML 5 Template</title>
</head>
<body>
</body>
</html>