Skip to content

Instantly share code, notes, and snippets.

View littlelazer's full-sized avatar

Eryan Cobham littlelazer

  • Chicago, Illinois
View GitHub Profile
@littlelazer
littlelazer / gist:433dddfbf70f56e6ba7bb0c43d0f1ab6
Created February 22, 2020 17:12 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@littlelazer
littlelazer / rails_new_help_output.md
Created March 8, 2018 20:35 — forked from eliotsykes/rails_new_help_output.md
"rails new" options explained

Run rails new --help to view all of the options you can pass to rails new:

$ bin/rails new --help
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby
@littlelazer
littlelazer / web-fonts-asset-pipeline.md
Created September 6, 2017 15:09 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

class ChildComponent extends React.Component {
render() {
const {hello} = this.props.greetings;
return <h1>{hello}</h1>;
}
}
const ChildContainer = Relay.createContainer(ChildComponent, {
initialVariables: {
name: 'A',
@littlelazer
littlelazer / capybara cheat sheet
Created June 13, 2017 17:45 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')

Overview

Here, you might lay out the reasons behind writing this code. You can link to specs, issues, or bugs in order to give someone a better idea of how a decision was made. This is your chance to give context to your reviewer. Ego depletion - the idea that willpower is used up over time - can be easily applied to your reviewer. We are human, after all. You'll likely get one shot at a quality review, so help your reviewer help you. Flush out this section.

Testing

How did you test this code? Did you write a unit test, or test it manually? Can you provide an animated gif or a screenshot to demonstrate your code does what it purports to do? What about test output or a useful snippet from a logfile? Help show that your code works.

🚨🚨🚨 (Risks)

Is there some part of the code that you know probably doesn't work as it should? Call out potential weak spots, and get help addressing them.

@littlelazer
littlelazer / gist:3000559
Created June 27, 2012 00:59 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@littlelazer
littlelazer / git-fresh
Created May 24, 2012 18:10 — forked from thetristan/git-fresh
Quick shell script to check the freshness of your git branches
#!/bin/bash
#
# Place this file somewhere in your path and make it executable
# Can then be ran within any repo by calling `git fresh` within that folder
#
(
for b in `git branch | sed 's:^[ *]*::'`
do
git log -n 1 $b -- | sed -e '4,$ d' -e '1,2 d' -e "s^Date:[ ]*^^" -e "s^\(.*\)$^\1 ~~~ ${b}^"
done
@littlelazer
littlelazer / uri.js
Created May 2, 2012 16:57 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@littlelazer
littlelazer / demo.html
Created April 24, 2012 17:14 — forked from dryan/demo.html
Utility function for translatable strings in JavaScript. See demo.html for usage examples.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Translation Demo</title>
<meta charset="utf-8">
</head>
<body>
<p id="hello"></p>
<h1>Usage</h1>
<p>Create an object called <code>translations</code> attached to the <code>window</code> object. That object should have a key for each language you want to support that points to an object containing key/value pairs for all of your strings.</p>