Skip to content

Instantly share code, notes, and snippets.

View truffaut's full-sized avatar
🙇‍♂️
Libertas!

Michael Ornellas truffaut

🙇‍♂️
Libertas!
View GitHub Profile
@truffaut
truffaut / Default (OSX).sublime-keymap
Last active December 28, 2015 03:49
Add this snippet to your Sublime Text user keybindings settings to add the ability to wrap a selected word/phrase in backticks. Useful for revising the Learn App markdown files.
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }
]
}
@truffaut
truffaut / .vimrc
Created February 13, 2014 17:46
A simple Vim configuration file to get you on your merry way.
set nocompatible " don't need Vi compatibility
syntax on " color syntax highlighting
set backspace=indent,eol,start " make backspace work normally
filetype plugin indent on " load filetype-specific plugins, indent, highlighting settings
set smarttab " make <TAB> use shiftwidth for spacing
set autoindent " new lines will have the same indentation as the line above
set smartindent " use smart autoindenting when starting new lines
set tabstop=2 " set tab width to 2 spaces
set expandtab " use the appropriate amount of spaces when inserting a tab
set shiftwidth=2 " number of spaces to use for each step of indent
class PigLatinTranslator
def translate(word)
if /\Ay/.match(word)
word.slice!(0)
word + "yay"
elsif match = /\A[^aeiouy]+/.match(word)
consonants = match.to_s.length
ending = word.slice!(0, consonants) + "ay"
word + ending
else
require "json"
require 'unirest'
require 'pry'
module GHFeed
class RepoInfo
def self.get_repo_data(username, reponame)
response = Unirest::get("https://api.github.com/repos/#{username}/#{reponame}/commits", auth:{:user=>ENV['USERNAME'], :password=>ENV['PASSWORD']})
response.body
end
@truffaut
truffaut / subl.sh
Last active August 29, 2015 13:57
Create subl symlink with a bash script
#!/bin/bash
if [ ! -h ~/bin/subl ]; then
if [ -f /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ]; then
echo "Creating subl link to Sublime Text"
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin/subl
elif [ -f /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl ]; then
echo "Creating subl link to Sublime Text 2"
ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl ~/bin/subl

You should use git to tag your final project before your Career Day presentations, especially if you plan to continue working on it. This will allow you to go back to the commit you were at for your Career Day presentation. This is especially helpful if you would like to show employers what you've worked on/changed since they saw your presentation.

A tag is kind of like a branch, but unlike branches they’re meant to be static. They’re usually used for releases (e.g. v2.0 for a library like AngularJS).

To make an ‘annotated tag’, (i.e. a tag with a message) run the following command in your project's directory:

git tag -a v0.5 -m 'Career Day’
## An alternate guide: https://gorails.com/deploy/ubuntu/14.04
So, you've built a cool Rails-based application, now you want to share it with others. You can go the Heroku route, they
have a free tier, its quick and painless, no mucking around in configuration files, just `git push` and you're done. But, what happens when you need more control? What happens when you build an application that uses a lot of functionality that only comes from paid add-ons on Heroku, but for a site that makes little-to-no revenue? In those situations, you can use a Virtual Private Server, or VPS for short.
#Why VPS?
VPS's are cheap, are relatively easy to setup (with some Linux know-how), and are much easier than having to deal directly with physical server hardware.
# Sign up for DigitalOcean
* Go here: https://www.digitalocean.com/
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@truffaut
truffaut / on-jsx.markdown
Last active August 29, 2015 14:27 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'