Skip to content

Instantly share code, notes, and snippets.

@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
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: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
named_scope :coming_soon,
:joins => :showtimes,
:having => 'showtimes.day > CURRENT_DATE'