Skip to content

Instantly share code, notes, and snippets.

students table
id name
1 Felix
2 John
3 Bob
assignments table
id student_id number status
@felixflores
felixflores / as_sql_models_sample.rb
Last active March 16, 2017 04:09
Sample Data for ActiveRecord Problem
class Student < ActiveRecord::Base
has_many :assignments
end
class Assignment < ActiveRecord::Base
belongs_to :student
end
@felixflores
felixflores / gist:7127eb73ddeb126900fc
Last active July 21, 2017 14:47
My Spacemacs Config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@felixflores
felixflores / gist:2ce479ae9f0b6e90a913
Last active August 29, 2015 14:15
Clojure Database Manipulation and Migration with Drift and SQLingvo

Overview

To create any non-trivial application, you need some way of persisting data. While there are a lot solutions available, Datomic, Neo4j, Samza, just to name a few, but for various reasons, a lot of us still use relational databases. One reason might be because there is a pre-existing Rails application that still needs to interoperate with the Clojure application you are building. Another reason could be because of the exisiting deployment environment requires you to use a certain type of database (I encountered this first hand while working for a large client).

+--------------+          +---------------+
|              |          |               |
|     Ruby     |          |               |
|      on      |          |   Compojure   |
|     Rails    |          | (Clojure app) |
@felixflores
felixflores / gist:4508072
Last active December 10, 2015 23:18
Felix' Open Source Bio for the Neo Website. Please help me finish this.
Felix is software developer who likes to dabble in art, snowboarding
and often times finds himself in very unusual situations.
@felixflores
felixflores / UIViewController+ActionSheet.h
Last active December 10, 2015 00:48
Make Action Sheet a little bit more sane
//
// UIViewController+ActionSheet.h
// Tweaks
//
// Created by Felix Flores on 12/21/12.
// Copyright (c) 2012 felixflor.es. All rights reserved.
//
#import <UIKit/UIKit.h>
@felixflores
felixflores / UIViewController+Segue.h
Last active December 9, 2015 22:08
A convenient category to make segue preparation a little nicer.
//
// UIViewController+Segue.h
// TimeCapsule
//
// Created by Felix Flores on 12/19/12.
// Copyright (c) 2012 felixflor.es. All rights reserved.
//
#import <UIKit/UIKit.h>
// Assuming you have underscore and jQuery as a project dependency.
// You can use this to include individual files on your jasmine specs.
// Sample Usage
requireJS('myJSfile', 'myOtherJsFile');
describe("My stuff", function() {
it("rocks", function() {
// your spec
class MoviesController < ApplicationController
def index
if params[:filter] == "coming_soon"
@movies = Movie.coming_soon
else
@movies_for_the_week = Movie.for_the_week
end
@view = params[:filter]
end
# WHAT!!!!
(rdb:27) @movies_for_the_week[1][:items].size
2
(rdb:27) @movies_for_the_week[1][:items]
[]
(rdb:27) @movies_for_the_week[1][:items].size
0
>> m = Movie.for_the_week