Skip to content

Instantly share code, notes, and snippets.

View ascruggs's full-sized avatar

Aaron Scruggs ascruggs

  • Austin TX
View GitHub Profile
class Tasks::ShowView < ApplicationView
attr_reader :task
delegate :taskable, :taskable_is_a_project?, :taskable_is_a_template?, to: :task
alias completeable? taskable_is_a_project?
alias assignable? taskable_is_a_project?
alias roleable? taskable_is_a_template?
@ascruggs
ascruggs / inbox
Created January 8, 2018 13:09
Write all todos in your inbox to a file on your desktop.
#!/usr/bin/env ruby
#gem install rb-scpt (ruby < 2.5.0)
require 'rb-scpt'
APP = Appscript.app("Things3.app")
def inbox
APP.lists.get.detect{|l| l.name.get == 'Inbox'}
end
class Teacher < ActiveRecord::Base
has_many :courses
has_many :lightbulbs, :through => "courses"
end
class Course < ActiveRecord::Base
has_many :lightbulbs
end
class Lightbulb < ActiveRecord::Base
module Datastores
module Memoizable
extend ActiveSupport::Concern
include ThreadLocal
KEY_REGEX = /`([^']*)'/
module ClassMethods
def memoize(key = nil, &block)
@ascruggs
ascruggs / gist:57c7d786f119d8afc6d5
Last active August 29, 2015 14:05
Learn To Code
### Keybase proof
I hereby claim:
* I am ascruggs on github.
* I am techscruggs (https://keybase.io/techscruggs) on keybase.
* I have a public key whose fingerprint is E977 06A0 014F 2376 1553 CF09 8C66 263C FA75 28FD
To claim this, I am signing this object:
@ascruggs
ascruggs / gist:7422080
Created November 11, 2013 22:55
sublime preferences
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
class Destination
def name
"boom"
end
end
def destination
Destination.new
desc 'add achievement to user'
params do
requires :id, type: String, desc: "Status ID."
requires :achievement_id, type: String, desc: "Achievement id you want to add"
end
put ':id' do
user = User.find params[:id]
achievement = Achievement.find params[:achievement_id]
user.achievements << achievement
end
@ascruggs
ascruggs / mobile-meta-links.html
Created December 7, 2012 21:11
iOS Web App Configuration