Skip to content

Instantly share code, notes, and snippets.

View coderguy's full-sized avatar

Daniel Ice coderguy

View GitHub Profile
### Keybase proof
I hereby claim:
* I am coderguy on github.
* I am coderguy (https://keybase.io/coderguy) on keybase.
* I have a public key ASCdVruaaOvD4vTUe_lR6THqBQpnCiYEH0UfcWJ0gAhbqgo
To claim this, I am signing this object:
@coderguy
coderguy / 01-setup.md
Last active February 9, 2018 21:26 — forked from baxterross/cookie.js
Email Capture Form

Configuration

  • Ensure the 'action' attribute of the Email Capture Form HTML points to the correct location (email-capture-form.html, line 3)
  • Change the 'thankYouPageLink' in the Email Capture Form JS to point to your site's Thank You page (email-capture-form.js, line 4)
  • Customize the Email Capture Form CSS match you page styling (after line 8)
  • Add Google Analytics tracking code (email-capture-form.html, line 26)
@coderguy
coderguy / twilio_request.rb
Last active January 18, 2016 20:00
Factories for testing twilio
FactoryGirl.define do
factory :voice_request, class: Hash do
defaults = {
Called: '+15125550198',
Digits: '',
RecordingUrl: '',
ToState: 'TX',
CallerCountry: 'US',
Direction: 'inbound',
CallerState: 'TX',
@coderguy
coderguy / Gemfile
Created January 16, 2016 22:09
Default Gemfile
source 'https://rubygems.org'
ruby '2.2.3'
# stuff that have to be loaded early
# heroku
gem 'fog-aws'
gem 'asset_sync'
gem 'dotenv-rails', groups: [:development, :test]
gem 'font-awesome-rails', '~> 4.3'
@coderguy
coderguy / repl.js
Created November 6, 2014 20:28
Repl with Node.js
"use strict";
var repl = require("repl");
var config = require('./config/');
var models = require('./app/models');
var replServer = repl.start({
prompt: "cio (" + config.get('env') + ") > "
});
@coderguy
coderguy / content_entry.rb
Created June 6, 2013 19:38
Locomotive CMS with tire
module Locomotive
class ContentEntry
include Tire::Model::Search
include Tire::Model::Callbacks
index_name INDEX_NAME
document_type "content"
end
@coderguy
coderguy / content_entry.rb
Last active December 17, 2015 17:19
The API for locomotive only returns slugs for children content. I wanted to be able to use the API to create a JSON only version of the site. This code does two things: 1. Creates a hash that includes all nested content for a content entry. 2. Overrides the presenter's as_json to allow it to display through the current API. So you can go to an e…
require_dependency Locomotive::Engine.root.join('app', 'models', 'locomotive', 'content_entry').to_s
require_dependency Locomotive::Engine.root.join('app', 'presenters', 'locomotive', 'content_entry_presenter').to_s
Locomotive::ContentEntry.class_eval do
def recursive_hash(depth=0)
base = custom_fields_basic_attributes
base[:id] = _id
base[:slug] = _slug