Skip to content

Instantly share code, notes, and snippets.

@jose8a
jose8a / gist:5409993
Created April 18, 2013 03:56
The single most useful thing in bash (from Coderwall user Jude Robinson)
#Create ~/.inputrc and fill it with this:
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
#This allows you to search through your history using the up and down arrows … i.e. type "cd /" and press the up arrow and you'll search through everything in your history that starts with "cd /".
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
<h2>App Academy ExpressJS Screencasts</h2>
<ul class="list-group">
<li><a href="http://vimeo.com/groups/appacademy/videos/88022112">1 - Module Exports</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88022113">2 - HTTP</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88022115">3 - Threads</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88022116">4 - Ruby IO Select</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88022119">5 - Ruby Event Reactor</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88025189">6 - Node Event Reactor</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88135357">7 - Express Routing</a></li>
<li><a href="http://vimeo.com/groups/appacademy/videos/88135358">8 - Express Next</a></li>
@jose8a
jose8a / NodeJS API Tutorial Sequence
Last active August 29, 2015 14:03
NodeJS API Tutorial Sequence
<li><a href="http://scottksmith.com/blog/2014/05/02/building-restful-apis-with-node/">RESTful API w/Node</a></li>
<li><a href="http://scottksmith.com/blog/2014/05/05/beer-locker-building-a-restful-api-with-node-crud/">RESTful API w/Node -- CRUD</a></li>
<li><a href="http://scottksmith.com/blog/2014/05/29/beer-locker-building-a-restful-api-with-node-passport/">RESTful API w/Node -- Passport</a></li>
<li><a href="http://scottksmith.com/blog/2014/07/02/beer-locker-building-a-restful-api-with-node-oauth2-server/">RESTful API w/Node -- OAuth2 Server</a></li>
<li><a href="http://scottksmith.com/blog/2014/09/14/beer-locker-building-a-restful-api-with-node-digest/">RESTful API w/Node -- Digest</a></li>
<li><a href="http://scottksmith.com/blog/2014/09/18/beer-locker-building-a-restful-api-with-node-username-and-password/">RESTful API w/Node -- Username and Password</a></li>
@jose8a
jose8a / NodeUpgrade
Last active August 29, 2015 14:04
How to Upgrade NodeJS ... e.g. as after a vulnerability/security patch
From: http://davidwalsh.name/upgrade-nodejs
Install n helper module via npm:
npm install n
Then do the following:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@jose8a
jose8a / Convert MARKDOWN files to HTML
Last active April 26, 2022 09:36
Converting a folder full of markdown files, each linking to each other ... convert those files to HTML, and convert the relative links to point to the new html files. Add code highlighting with highlight.js . Finally serve up the result as a static web site.
Converting md files to html w/highlighting
0a) Create a root directory to pull in all the repos
0b) Recursively clone or pull each repo
$> git clone <repo_url> | git pull on the existing repos
0c) Create a TOC index.html file for the root folder
$> echo '<head>' >> index.html
$> echo '' >> index.html
$> echo '</head>' >> index.html
$> echo '<body>' >> index.html
$> ls >> temp.html
@jose8a
jose8a / RailsDevTools
Last active August 29, 2015 14:05
Development Gems and Browser Extensions for Rails projects to improve productivity, access, and debugging
// documentation for installed gems:
gem server
// use railroady to generate model/controller uml diagrams
rake diagram:all
// updating a single gem at a time
http://ilikestuffblog.com/2012/07/01/you-should-update-one-gem-at-a-time-with-bundler-heres-how/
$> bundle update ––source GEMNAME
@jose8a
jose8a / AssociationMethods
Last active August 29, 2015 14:05
Rails: Methods gained via Associations
//***** ------- Order belongs_to Customer ==> methods gained:
@order.customer
@order.customer=
@order.build_customer(customer_number: 123, customer_name: "Joe Blow") --> only creates customer instance ... does not save!
@order.create_customer((customer_number: 123, customer_name: "Joe Blow") --> creates instance and saves it!
@order.create_customer!( ... ) --> raises error if record is not valid
//***** ------- Customer has_many Orders ==> methods gained:
@orders = @customer.orders
@jose8a
jose8a / RailsCheatsheet
Last active August 29, 2015 14:05 — forked from rstacruz/index.md
Cheatsheet for Ruby on Rails
# Misc Tips/Tricks
### Limit the size of your Rails Test/Dev Logs
https://www.stormconsultancy.co.uk/blog/development/tips-tricks/limit-the-size-of-your-rails-test-and-development-logs/
```
In your config/environments/test.rb and development.rb just add the line:
config.logger = Logger.new(config.paths['log'].first, 1, 50 * 1024 * 1024)
and your log files will never grow bigger than 50Mb. You can change the size to your own preference. The ‘1’ in the second parameter means that 1 historic log file will be kept, so you’ll have up to 100Mb of logs – the current log and the previous chunk of 50Mb.
@jose8a
jose8a / RailsAuthSetupGuide
Last active August 29, 2015 14:12
Adding Devise + OmniAuth to Rails 4 App
### This Guide is summary of steps outlined in the guide published by
### DigitalOcean here: https://www.digitalocean.com/community/tutorials/how-to-configure-devise-and-omniauth-for-your-rails-application
### TODO: automate this guide into a ruby script
### TODO: required auth tokens to be read from a local 'keys' folder w/individual
### PROVIDER (Twitter, FB, GH, Goog, etc.) token json files
X ----- [1] Add to Gemfile
gem 'therubyracer'