Skip to content

Instantly share code, notes, and snippets.

Chris Raethke codesoda

Block or report user

Report or block codesoda

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
View number.js
const padLeft = (number, n,str) => {
return number.toString().length >= n ? number : Array(n-String(number).length + 1).join(str||'0') + number;
const playTime = (milliseconds) => {
let seconds = milliseconds / 1000.0,
hours = Math.floor(seconds / 3600),
minutes = Math.floor((seconds % 3600) / 60),
only_seconds = Math.round(seconds % 60),
parts = [];
codesoda / Gemfile
Created Jan 11, 2018 — forked from chezou/Gemfile
Example code of ruby with Amazon Polly
View Gemfile
source ''
gem 'nokogiri', '~>1.6'
gem 'aws-sdk', '~> 2'
codesoda /
Created Sep 4, 2017 — forked from iros/
Documenting your REST API


<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

codesoda /
Created Sep 9, 2016
Check apple store to see if iphone is available yet
main() {
while [[ true ]]; do
local request="$(curl -s '' | grep 'be back soon')"
if [[ ! $request ]]; then
say 'Yep, time to buy'
View my_class.rb
# this is running in Project 2
class MyClass
def some_process
# if the worker was in this project I could do this
# MyWorker.perform_async(...args)
# but the worker isn't in my project
# I always thought I could do this, but it seems it needs
# class: ActualClass,
# not
codesoda / typekit.js
Created Jun 28, 2016
Typekit + sessionstorage + no FOUT
View typekit.js
(function(d) {
var tkTimeout=3000;
var config = {
kitId: 'abc1234',
scriptTimeout: tkTimeout
h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";if(window.sessionStorage){sessionStorage.setItem("useTypekit","false")}},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
codesoda / Guardfile
Last active May 12, 2016
Guard Error
View Guardfile
# use mac notification center
notification :terminal_notifier
guard :rspec, cmd: 'bin/rspec' do
require "guard/rspec/dsl"
dsl =
# Feel free to open issues for suggestions and improvements
# RSpec files
codesoda / base.rb
Created Sep 28, 2015 — forked from bensie/base.rb
Sinatra API Helpers
View base.rb
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
codesoda / rspec_model_testing_template.rb
Last active Aug 29, 2015 — forked from kyletcarlson/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems:
codesoda / .rspec
Last active Aug 29, 2015
Sinatra Template
View .rspec
--format Fuubar
--require spec_helper
You can’t perform that action at this time.