Skip to content

Instantly share code, notes, and snippets.

View esteedqueen's full-sized avatar
😼

Esther Olatunde esteedqueen

😼
View GitHub Profile
@esteedqueen
esteedqueen / filterable.rb
Created November 10, 2015 01:00 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from
@esteedqueen
esteedqueen / Redis Cloud overview.md
Created November 13, 2015 16:34 — forked from Yiftach/Redis Cloud overview.md
Heroku - Redis Cloud overview

Redis Cloud is a fully-managed service for running your Redis dataset. You can quickly and easily get your apps up and running with Redis Cloud through its add-on for Heroku, just tell us how much memory you need and get started instantly with your first Redis database. You can then add as many Redis databases as you need (each running in a dedicated process, in a non-blocking manner) and increase or decrease the memory size of your plan without affecting your existing data. You can easily import an existing dataset to any of your Redis Cloud databases, from your S3 account or from any other Redis server. Daily backups are performed automatically and in addition, you can backup your dataset manually at any given time.

Getting started

Start by installing the add-on:

:::term

$ heroku addons:add rediscloud

@esteedqueen
esteedqueen / Gemfile
Created May 23, 2016 12:10 — forked from chocnut/Gemfile
iOS AC + Social(Facebook) Framework & Rails(omniauth-facebook)
gem 'devise'
gem 'omniauth-facebook'
@esteedqueen
esteedqueen / show.html.erb
Created June 6, 2016 11:55 — forked from davidphasson/show.html.erb
ERB and the case statement
# Doesn't work
<p>
<% case @request.author_hosted %>
<% when "yes" %>
The school <b>has</b> hosted an author before.
<% when "no" %>
The school <b>has not</b> hosted an author before.
<% end %>
</p>
@esteedqueen
esteedqueen / osx-homebrew-setup.md
Created November 8, 2016 14:57 — forked from sr75/osx-homebrew-setup.md
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@esteedqueen
esteedqueen / migration-error.md
Created November 8, 2016 15:03 — forked from nruth/migration-error.md
rails migration pg_dump: invalid option -- 'i'

If you start to see something like this, e.g. on Heroku since they installed the postgres 9.5 client libraries on their dynos

/usr/lib/postgresql/9.5/bin/pg_dump: invalid option -- 'i'
Try "pg_dump --help" for more information.
rake aborted!
Error dumping database
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb:55:in `structure_dump'
@esteedqueen
esteedqueen / rbenv-howto.md
Created November 8, 2016 16:39 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@esteedqueen
esteedqueen / .rbenv-gemsets
Last active December 13, 2016 12:30
Rspec TDD intro
tdd
@esteedqueen
esteedqueen / MyDBHandler.java
Last active December 13, 2016 12:57
working with sqliteopenhelper
public class MyDBHandler extends SQLiteOpenHelper {
// ...existing methods...
public static class StudentDetailCursor extends SQLiteCursor {
/** The query for this cursor */
private static final String QUERY =
"SELECT _id, _studentname, _phone, _address, lat, lng, zom FROM students ";
/** Cursor constructor */
private StudentDetailCursor(SQLiteDatabase db, SQLiteCursorDriver driver,