Skip to content

Instantly share code, notes, and snippets.

🙃

Josh Chernoff joshchernoff

🙃
Block or report user

Report or block joshchernoff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshchernoff
joshchernoff / my_model.ex
Created Aug 17, 2016
Whats a good way to check if a change set is new ?
View my_model.ex
defmodule MyApp.Mymodel do
schema "the_table" do
field :uuid, :string
...
timestamps()
end
@doc """
Builds a changeset based on the `struct` and `params`.
"""
View config
config :ex_aws,
access_key_id: [{:system, "xxxxxx"}, :instance_role],
secret_access_key: [{:system, "xxxxx"}, :instance_role],
region: "us-west-2",
debug_requests: true
View gist:f9d961af68451ca135b8d9b607e567de
21:28:01.981 [error] ** Websocket handler Catbug.Bot terminating
** for the reason {:handler,
{:badkey, :text,
%{channel: "C0ZBTJZQQ", event_ts: "1461990481.035809", hidden: true,
message: %{attachments: [%{fallback: "544x352px image",
from_url: "https://45.media.tumblr.com/62b167879a37b87de49e6bf7b7c23af7/tumblr_n2gb89SmGu1r922pyo1_1280.gif",
id: 1, image_bytes: 684915, image_height: 352,
image_url: "https://45.media.tumblr.com/62b167879a37b87de49e6bf7b7c23af7/tumblr_n2gb89SmGu1r922pyo1_1280.gif",
image_width: 544, is_animated: true}],
text: "You're my friends now. We're having soft tacos later! <https://45.media.tumblr.com/62b167879a37b87de49e6bf7b7c23af7/tumblr_n2gb89SmGu1r922pyo1_1280.gif>",
@joshchernoff
joshchernoff / cart_spec.rb
Last active Aug 29, 2015
rspec mocking with has_many
View cart_spec.rb
require 'spec_helper'
describe Cart do
describe "#to_s" do
let(:cart) { FactoryGirl.create(:cart) }
context "when cart is empty" do
it{ subject.to_s.should == "Your cart is empty" }
View control rgb led
int redPin = A4;
int greenPin = A0;
int bluePin = A1;
void setup()
{
Spark.function("rgb", rgbControl);
pinMode(redPin, OUTPUT);
@joshchernoff
joshchernoff / Gruntfile.js
Created Feb 11, 2014
Email builder grunt file.
View Gruntfile.js
module.exports = function(grunt){
'use strict';
grunt.initConfig({
connect: {
server: {
options: {
port: 9000,
base: 'src',
@joshchernoff
joshchernoff / application_controller.rb
Created Jan 5, 2014
Devise + Authority Redirect to root is not authorized else ask using to login first. auth_current_user is used in place of current_user for authority to prevent a "No Method found on nil" error.
View application_controller.rb
class ApplicationController < ActionController::Base
[...]
def authority_forbidden(error)
Authority.logger.warn(error.message)
if user_signed_in?
flash[:alert] = "Not authorized to view this page"
session[:user_return_to] = nil
redirect_to root_url
else
@joshchernoff
joshchernoff / tag_gen.rb
Created Jul 13, 2013
A plugin for generating tags in jekyll source from http://charliepark.org/tags-in-jekyll/
View tag_gen.rb
module Jekyll
class TagIndex < Page
def initialize(site, base, dir, tag)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
self.data['tag'] = tag
@joshchernoff
joshchernoff / Rakefile
Last active Dec 19, 2015
Publish your jeykll _site files to master so that you can build out your jekyll plugins for uses with github pages. Source from http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-github-pages.html
View Rakefile
require "jekyll"
require 'tmpdir'
GITHUB_REPONAME = "digitalcake/digitalcake.github.com"
SOURCE = "."
CONFIG = {
'layouts' => File.join(SOURCE, "_layouts"),
'posts' => File.join(SOURCE, "_posts")
}
You can’t perform that action at this time.