Skip to content

Instantly share code, notes, and snippets.

@s2t2
s2t2 / favs_controller
Created May 27, 2017 02:35
rails scaffold controller
class FavsController < ApplicationController
before_action :set_fav, only: [:show, :edit, :update, :destroy]
# GET /favs
# GET /favs.json
def index
@favs = Fav.all
end
# GET /favs/1
@s2t2
s2t2 / rails http status codes
Created May 26, 2017 20:49 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
require "pry"
require "mechanize"
require "pdf-reader"
URL = "http://employmentsummary.abaquestionnaire.org/"
agent = Mechanize.new
agent.pluggable_parser.pdf = Mechanize::File # ... not sure whether to use Mechanize::Download or Mechanize::File
page = agent.get(URL)
@s2t2
s2t2 / curl.md
Created April 13, 2017 19:38 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@s2t2
s2t2 / .block
Created March 18, 2017 06:38 — forked from mbostock/.block
Every ColorBrewer Scale
license: gpl-3.0
@s2t2
s2t2 / README.md
Created March 18, 2017 06:37 — forked from pykerl/README.md
Color scheme picker using ColorBrewer scales.
Color scheme picker using ColorBrewer scales

A color scheme picker based on Mike Bostock's visual reference to every ColorBrewer scale (colors by Cynthia Brewer). Not perfect, but just a first try.

Mike Bostock's color brewer scales are available in CSS and JS format.

Click on a palette to change the color scheme. The data is based on 2010 US Census blocks for Georgia aggregated into grid squares.

@s2t2
s2t2 / README.md
Last active February 15, 2017 14:39

Command-line Computing

Use the command line to manipulate the local filesystem.

Objectives

  1. Familiarize yourself with the command line.

Prerequisites

#!/bin/bash
# download to your desktop, then run with: bash ~/Desktop/my_mac_script.sh
echo "Hello, $USER."
sleep 2
echo "The current time is: $(date)."
sleep 2
echo "You are running this script from within the following folder:"
sleep 2
@s2t2
s2t2 / student_website_exercise.md
Last active March 6, 2022 08:49
Fork the Repo (Student Personal Website)

Fork the Repo

Leverage an existing open source website to publish your own.

Note: your website content will be available to the public.

Objectives

  1. Develop a familiarity with open source software, software version control, and website hosting.
  • Gain exposure to a basic website, noting its directory structure and observing HTML document structures and content.
@s2t2
s2t2 / GIF-Screencast-OSX.md
Created January 28, 2017 19:02 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: