Skip to content

Instantly share code, notes, and snippets.

Chad Seeger cseeger

Block or report user

Report or block cseeger

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
@cseeger
cseeger / commit-msg
Last active Feb 22, 2019
Git Hook to automate inclusion of JIRA (`[ABC-123]`) formatted ticket ids in your commit message
View commit-msg
#!/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]+\]/
@cseeger
cseeger / storybook_spec.js
Last active Feb 12, 2019 — forked from xogeny/storybook_spec.js
Cypress testing of Storybook
View storybook_spec.js
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 / enumerator.rb
Created Mar 6, 2018
Fun with Ruby's Enumerator
View enumerator.rb
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 / string.rb
Created Mar 8, 2017 — forked from romansklenar/string.rb
Ruby string to boolean type casting
View string.rb
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 / triangle.cr
Created Sep 8, 2016
Example C-lib binding in Crystal
View triangle.cr
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
View nested_mass_assignment.rb
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 / decode_session_cookie.rb
Last active Mar 31, 2016 — forked from pdfrod/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
View decode_session_cookie.rb
View form.html.eex
<%= 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 / e-commerce.md
Created Nov 26, 2012 — forked from hjr3/e-commerce.md
Examples of RESTful API calls for E-commerce platforms
View e-commerce.md

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

@cseeger
cseeger / build.sh
Created Oct 24, 2012
build script for jenkins
View build.sh
#!/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)"
You can’t perform that action at this time.