Skip to content

Instantly share code, notes, and snippets.

@nicksoto
nicksoto / arel_cheatsheet_on_steroids.md
Created February 2, 2024 16:46 — forked from ProGM/arel_cheatsheet_on_steroids.md
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@nicksoto
nicksoto / 00_README.md
Created March 28, 2017 16:57 — forked from dbalatero/00_README.md
This is an example of how I combine interaction/service classes with Wisper event broadcasting inside Rails.

This is an example of how I combine interaction/service classes with Wisper event broadcasting in Rails.

In this example, I show a UsersController#create API, a corresponding service object, and all the test code/listeners to make it all happen.

The outcome is:

  • Concepts in your system ("Signing up a user", "Creating an order") have a single entry point in your codebase, vs. making stupid raw ActiveRecord calls to object.save in dozens of places.
  • Since your concept has one entry point (the service class), you can easily grep for usage of it.
  • Stupid easy to attach listeners to the service class
  • All event listeners are very small and easily unit tested
# /etc/mail/sendmail.conf
#
# Copyright (c) 2001-2010 Richard Nelson. All Rights Reserved.
# Version: 8.14.4
# Time-stamp: <2014-02-11 13:02:08 cowboy>
#
# Parameter file for sendmail (sourced by /usr/share/sendmail/sendmail)
# Make all changes herein, instead of altering /etc/init.d/sendmail.
#
# After making changes here, you'll need to run /usr/sbin/sendmailconfig
@nicksoto
nicksoto / androidbuildsetup.0.0.1
Created June 6, 2012 03:29
Android Build Setup for Rhomobile
Tested only on Mac 10.7.4, Core 2 Duo
1.) Go to oracle.com and download the java jdk. My files were output to:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk
2.) gem install rhodes (or sudo gem install rhodes)
3.) Assuming you have Homebrew installed:
brew install qt (this make take an hour to install)