Skip to content

Instantly share code, notes, and snippets.

View cseeger's full-sized avatar

Chad Seeger cseeger

  • San Francisco, CA
View GitHub Profile
@cseeger
cseeger / build.sh
Created October 24, 2012 17:55
build script for jenkins
#!/bin/bash
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
PROJECT_NAME=""
TARGET_SDK="iphoneos"
APPLICATION_NAME=""
DEVELOPER_NAME="iPhone Distribution: blahblah."
PROVISIONING_PROFILE="ProductionPush_10_10.mobileprovision"
TIME_STAMP="$(date +%m/%d/%y) $(date +%r)"
@cseeger
cseeger / e-commerce.md
Created November 26, 2012 03:44 — forked from hjr3/e-commerce.md
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
<p> Something is broken. Check the following: </p>
<ul>
<%= for {attr, message} <- f.errors do %>
<li>
<%= humanize(attr) %>
&nbsp;
<%= message %>
</li>
@cseeger
cseeger / decode_session_cookie.rb
Last active March 31, 2016 23:52 — forked from pdfrod/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
module NestedMassAssignment
extend ActiveSupport::Concern
included do
include ActiveAttr::BasicModel
include ActiveAttr::BlockInitialization
include ActiveAttr::Logger
# include ActiveAttr::MassAssignment
include ActiveAttr::AttributeDefaults
include ActiveAttr::QueryAttributes
@cseeger
cseeger / triangle.cr
Created September 8, 2016 04:57
Example C-lib binding in Crystal
module Radians
class Triangle
lib C
# In C: double cos(double x)
fun cos(value : Float64) : Float64
end
def cos(value : Float64)
C.cos(value)
end
@cseeger
cseeger / string.rb
Created March 8, 2017 01:20 — forked from romansklenar/string.rb
Ruby string to boolean type casting
class String
def to_bool
case
when self == true || self =~ /^(true|t|yes|y|1)$/i
true
when self == false || self.blank? || self =~ /^(false|f|no|n|0)$/i
false
else
raise ArgumentError.new "invalid value for Boolean: '#{self}'"
@cseeger
cseeger / enumerator.rb
Created March 6, 2018 18:32
Fun with Ruby's Enumerator
class Whatever
def run
fetch_paginated_data('Whatever...').each do |item|
puts item
end
end
def fetch_paginated_data(obj)
Enumerator.new do |yielder|
loop do
@cseeger
cseeger / storybook_spec.js
Last active February 12, 2019 19:01 — forked from xogeny/storybook_spec.js
Cypress testing of Storybook
describe('Storybook', () => {
beforeEach(() => {
cy.visit('http://airbnb.io/react-dates/')
})
context('DateRangePicker', () => {
it('should visit the default story in this collection', () => {
cy.get('a[data-name="default"]').click()
// Get the iframe for the components and make assertions on that.
@cseeger
cseeger / commit-msg
Last active February 22, 2019 20:21
Git Hook to automate inclusion of JIRA (`[ABC-123]`) formatted ticket ids in your commit message
#!/usr/bin/env ruby
#
# Install via:
# `curl GIST_URL > .git/hooks/commit-msg && chmod u+x .git/hooks/commit-msg`
COMMIT_MESSAGE = File.read(ARGV[0])
def check_commit_message
message_regex = /\[[A-Z]+-[0-9]+\]/