Skip to content

Instantly share code, notes, and snippets.

View mattboldt's full-sized avatar

Matt Boldt mattboldt

View GitHub Profile
@mattboldt
mattboldt / 0_reuse_code.js
Created October 16, 2013 22:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# model name is "Code"
# using acts_as_taggable
# takes in URL like domain.com/code/tags/first-tag+second-tag
# variable foo splits the string, sorts alphabetically, and rejoins the string
# if the current params don't equal the sorted params, redirect to
# code_tags_path plus the sorted string
# codes_controller.rb
# Admin CodesController
class Admin::CodesController < AdminController
def index
end
def show
@code = Code.find(params[:id])
end
def edit
@code = Code.find(params[:id])
@mattboldt
mattboldt / rails_resources.md
Created November 23, 2013 19:27 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@mattboldt
mattboldt / gist:7621795
Last active December 29, 2015 05:29
Test: Multiple files in Gist
def test
print "hello"
end
@mattboldt
mattboldt / authentications_controller.rb
Last active April 21, 2017 16:59
OmniAuth & Octokit.
class AuthenticationsController < ApplicationController
# This is the callback method from OmniAuth's GitHub authentication.
# following http://railscasts.com/episodes/236-omniauth-part-2
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
sign_in_and_redirect(:user, authentication.user)
end
module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-sass')
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
undefined local variable or method `session' for #<Devise::FailureApp:0x00000005a421d0>
devise (3.2.2) lib/devise/controllers/store_location.rb:38:in `store_location_for'
devise (3.2.2) lib/devise/failure_app.rb:194:in `store_location!'
devise (3.2.2) lib/devise/failure_app.rb:57:in `redirect'
devise (3.2.2) lib/devise/failure_app.rb:39:in `respond'
actionpack (3.2.6) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.6) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.6) lib/action_controller/metal.rb:203:in `dispatch'
#### Getting the following error ####
# Error while loading route: undefined
# Store
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
App.ApplicationAdapter = DS.ActiveModelAdapter.extend()
# ember router
App.Router.reopen
location: 'history'
rootURL: '/u/'
App.Router.map ->
@route 'login'
@resource('documents', path: '/')
@route('new')