Skip to content

Instantly share code, notes, and snippets.

View sammcgrail's full-sized avatar
🎯
Focusing

Sam McGrail sammcgrail

🎯
Focusing
View GitHub Profile
@sammcgrail
sammcgrail / cli.md
Last active August 29, 2015 14:18 — forked from radavis/cli.md

Using the OSX Command Line

Directory Shortcuts

~ - Home Directory
. - Current Directory
.. - Enclosing Directory
/ - Root Directory
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@sammcgrail
sammcgrail / tdo.rb
Last active August 29, 2015 14:26 — forked from sirupsen/tdo.rb
Gist for "What I Wish a Ruby Programmer Had Told Me One Year Ago".
class TodoList < Array
def self.load(file)
# read the file, create a list, create items, add them to the list, return the list
list = TodoList.new
File.read(file).each_line do |line|
list << line.chomp
end
list
end
@sammcgrail
sammcgrail / ember-resources.md
Last active August 29, 2015 14:27 — forked from thomascchen/ember-resources.md
Ember Resources

Resources for Learning Ember.js

Here's a list of resources that have been helpful for me in getting acquainted with Ember.js, in no particular order. Ember is relatively young and changing really fast, so I found that searching for answers on Google and Stack Overflow was not quite as easy as it is with Rails. Try to stick with resources that have been written in the past few months. Look at the older stuff too but remember that things have likely changed.

@sammcgrail
sammcgrail / flask_ajax.py
Created December 22, 2015 18:31 — forked from MalphasWats/flask_ajax.py
Making a basic AJAX request with Flask
# Answer to a question on Flask mailing list
# http://librelist.com/browser//flask/2012/6/30/using-ajax-with-flask/
# NOTE: *REALLY* don't do the thing with putting the HTML in a global
# variable like I have, I just wanted to keep everything in one
# file for the sake of completeness of answer.
# It's generally a very bad way to do things :)
#
from flask import (Flask, request, jsonify)
app = Flask(__name__)
@sammcgrail
sammcgrail / vim-cheat-sheet.md
Created February 18, 2016 22:21 — forked from ummahusla/vim-cheat-sheet.md
Vim Cheat Sheet

Modes

Vim has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for "colon" commands which execute when you press the ruturn key.

Quitting

  • :x Exit, saving changes
  • :q Exit as long as there have been no changes
  • ZZ Exit and save changes if any have been made
  • :q! Exit and ignore any changes

Inserting Text

@sammcgrail
sammcgrail / README.mkd
Created April 26, 2016 20:37 — forked from christophermanning/README.mkd
Hamiltonian Graph Builder
<style type="text/css">p {text-align:center;width: auto}</style>

Created by Christopher Manning

Gallery

Axle Eight [Fibbobaci](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1) [Florets](http://bl.ocks.org/d/1703449/#/