Skip to content

Instantly share code, notes, and snippets.

View eliotsykes's full-sized avatar

Eliot Sykes eliotsykes

View GitHub Profile
@joelip
joelip / README.md
Last active August 29, 2015 14:06

Using Nitrous

Nitrous Dashboard

Nitrous is a powerful IDE (integrated development environment) for building and previewing web applications. With a live console, text editor (with syntax highlighting), and server with preview options, it has everything you need to develop for Bloc Courses.

Signing Up

Creating an account is simple. Go to nitrous.io and enter in a username, password and email. You can even use your Github account to login if you're wary of creating another account for a singular purpose.

@eliotsykes
eliotsykes / rails-dev-box-postgresql-HOWTO.md
Last active August 29, 2015 14:07
How to setup rails-dev-box & PostgreSQL

SSH to the vagrant OS command line.

Terminal $> vagrant ssh

Login to postgres database as vagrant user with the psql client:

vagrant@rails-dev-box: psql -U vagrant postgres
@BattleBrisket
BattleBrisket / WEBrick default address binding.md
Last active September 9, 2015 10:33
Revert WEBrick bind address in Rails 4

Rails changed the default behavior for WEBrick somewhere around version 4. Instead of binding to 0.0.0.0, it will now default to localhost.

This makes life difficult when you're running Rails inside a VM like Vagrant, mostly because it won't work. ;)

Fortunately, you can force Rails back into the old universal address with the following snippet

# config/boot.rb

# ... end of existing file
@joshsusser
joshsusser / silence_assets.rb
Created April 17, 2012 22:34
put in config/initializers to silence asset logging in Rails development mode
if Rails.env.development?
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/assets/}
call_without_quiet_assets(env)
ensure
@eliotsykes
eliotsykes / asset_server_middleware.rb
Last active December 20, 2015 01:29
***** Checkout the rack-zippy gem, I recommend it over this gist, find it at https://github.com/eliotsykes/rack-zippy ***** An asset server for Rails 3.2.x that serves asset pipeline precompiled assets to clients, including those elusive gzipped (.gz) assets. Sadly Rails' own ActionDispatch::Static middleware does not take care of serving gzippe…
# 1. Add rack-rewrite to your Gemfile and run 'bundle install':
# gem 'rack-rewrite'
#
# 2. Create a file with the contents below in config/initializers/asset_server_middleware.rb
#
# 3. Rename 'YourApp' below
#
# 4. In config/environments/production.rb and config/environments/test.rb, set:
# config.serve_static_assets = true
# config.assets.compile = false
@eliotsykes
eliotsykes / deploy
Last active January 4, 2016 20:50
bin/deploy for rails+heroku app
#!/bin/sh
# Create this file in the bin/ directory of your
# Rails app.
# Run this script to deploy the app to Heroku.
set -e
# Push changes to Heroku
@eliotsykes
eliotsykes / naive_hash.rb
Last active January 6, 2016 16:46
Evolving NaiveHash into RubyHash
# Copy NaiveHash (end of this file) and rename to RubyHash.
#
# Try using RubyHash in irb/pry and store some data in it
# and notice it has problems with remembering all of your data due
# to RubyHash not handling hash collisions:
#
# require_relative 'ruby_hash'
# h = RubyHash.new
# ('a'..'z').each do |char|
# h[char] = char.upcase
@eliotsykes
eliotsykes / capybara_finder_options_cheatsheet.md
Last active February 18, 2016 15:57
Capybara Finder Options Cheatsheet

Capybara Options Hash (options) for all, find:

  • text (String, Regexp) — Only find elements which contain this text or match this regexp
  • visible (Boolean, Symbol) — Only find elements with the specified visibility:
    • true - only finds visible elements.
    • false - finds invisible and visible elements.
    • :all - same as false; finds visible and invisible elements.
    • :hidden - only finds invisible elements.
    • :visible - same as true; only finds visible elements.
  • count (Integer) — Exact number of matches that are expected to be found
@eliotsykes
eliotsykes / logger.js
Last active March 13, 2017 10:53
Logging JavaScript client-side to floating div
// Requires jQuery
var logger = {
setup: function() {
$('<div style="position:fixed; top: 0; left: 0; width: 100%; background-color: white;"><pre id="log-output" style="max-height: 70px; font-size: 10px; line-height: 12px;"></pre></div>')
.appendTo('body');
this.logOutput = $('#log-output');
},
info: function(msg) { this.logOutput.prepend(msg + "\n"); },
hide: function() { this.logOutput.parent().hide(); },
show: function() { this.logOutput.parent().show(); }
@eliotsykes
eliotsykes / angularjs-rails-apps.md
Last active August 1, 2017 18:17
AngularJS Rails apps

Open Source AngularJS Rails Apps

Expect some false positives here, but hopefully most of these are open source Rails apps that use (or once used) AngularJS.

If you'd like to help update the list, please comment below with any of these apps you discover do not use AngularJS and include my username (@eliotsykes) in your message.

Confirmed using AngularJS