Skip to content

Instantly share code, notes, and snippets.

View westonplatter's full-sized avatar

westonplatter

View GitHub Profile
@westonplatter
westonplatter / preferences
Last active October 12, 2015 23:48
the beggings of my dotfile system
````git
git config --global // username, email, other
git config --global push.default current
````
````javascript
{
"auto_complete": true,
@westonplatter
westonplatter / example.rb
Created December 1, 2012 23:15
Why does 'extend ActiveSupport::Concern' cause `undefined method 'recycle!'`?
# code in my rails engine
moduel MyEngine
class SomeController
extend ActiveSupport::Concern
def engine_some_method
end
end
end

YARD CHEATSHEET http://yardoc.org

cribbed from http://pastebin.com/xgzeAmBn

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.

Running local YARD server

regenerates docs for each request

@westonplatter
westonplatter / rails_4_polymorphic_where_power
Created March 9, 2013 01:58
Code snippet showing how to search for polymorpic related Rails Active Record relying on Rails 4 SQL duct typing magic!
class Post < ActiveRecord::Base
has_many :comments, as: commentable
# attributes, :title
end
class Comment < ActiveRecord::Base
belongs_to :commentable, polymorphic: true
end
require 'open-uri'
require 'nokogiri'
class Fetcher
attr_accessor :url, :content_path, :page, :counter
def initialize
@counter = 0
@page = 0
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
```yml
developmet:
host:
username:
password:
```
@westonplatter
westonplatter / gist:6152623
Last active December 20, 2015 15:18
varkek example JSON doc
topic = {
"name": "Evil and Suffering",
"bridge": { "content": "God never intended for life to be filled with pain." },
"questions": { "question": { "content": "As a parent, how would you care for children?"},
"question": { "content": "When have you had painful experiences?" }
},
"barriers": { "barrier" : { "order": "0", "content": "Lost someone very close to them" },
load 'deploy/assets'
set :stages, %w(production staging)
set :default_stage, 'staging'
require 'capistrano/ext/multistage'
require 'capistrano-unicorn'
require 'bundler/capistrano'
require 'rvm/capistrano'
@westonplatter
westonplatter / Environment.h
Last active December 22, 2015 08:29
How to reference environment specific iOS Enviroment Variables. Followed this example, and updated to reflect ARC usuage. http://blog.carbonfive.com/2011/06/20/managing-ios-configurations-per-environment-in-xcode-4/
//
// Environment.h
// Visible
//
// Created by weston on 9/4/13.
// Copyright (c) 2013 Visible. All rights reserved.
//
#import <Foundation/Foundation.h>