Skip to content

Instantly share code, notes, and snippets.

View jurre's full-sized avatar

Jurre jurre

View GitHub Profile
@jurre
jurre / decorator.rb
Last active August 29, 2015 14:16
Simple Collection Decorator that plays nice with Kaminari
class BaseDecorator
def initialize(source)
@source = source
end
def method_missing(method_key, *args, &block)
@source.send(method_key, *args, &block)
end
def respond_to_missing?(method_key, *args, &block)
@jurre
jurre / bench.rb
Created January 13, 2015 10:51
roar vs ams
require "bundler"
require "active_model_serializers"
require "roar"
require "roar/json/json_api"
require "benchmark"
require "ffaker"
Post = Struct.new(:id, :author, :body, :draft) do
include ActiveModel::Serializers::JSON
end
@chriseidhof
chriseidhof / LICENSE
Last active July 16, 2019 13:14
A tiny networking library
Copyright 2015 Chris Eidhof
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHE
@jurre
jurre / gist:a1ade23f7b42e8c3ccd7
Created September 9, 2014 11:58
omg-apple-keynote
#!/bin/bash
formatted_time() {
local total_seconds=${1}
((hours=total_seconds/3600))
((minutes=total_seconds%3600/60))
((seconds=total_seconds%60))
printf "%02d:%02d:%02d\n" $hours $minutes $seconds
}
@alexanderjeurissen
alexanderjeurissen / stringToPastel.js
Last active January 2, 2016 07:49
String to pastelcolor script. If added to your project you can simply use: "string to be converted".getPastel(); to convert the string to a pastel color.
String.prototype.getPastel = function (rgb) {
var radix = (!rgb) ? 16 : 10;
var hashCode = this.split("").reduce(function (a, b) {
a = ((a << 5) - a) + b.charCodeAt(0);
b = ((b << 5) - b) + a;
return a << b;
}, 0);
var rad = function (bitshift) {
@tonyklawrence
tonyklawrence / teamcity.coffee
Last active December 29, 2015 01:59
Dashing Teamcity Widget
class Dashing.Teamcity extends Dashing.Widget
@accessor 'state', Dashing.AnimatedValue
onData: (data) ->
if data.status
$(@get('node')).attr 'class', (i,c) -> c.replace /\bstatus-\S+/g, ''
$(@get('node')).addClass "status-#{data.status}"
@davidjrice
davidjrice / .travis.yml
Last active October 23, 2019 16:17 — forked from johanneswuerbach/.travis.yml
Travis CI + TestFlight integration (updated for Travis' new Mac VM setup / xctool)
language: objective-c
xcode_workspace: "<WorkspaceName.xcworkspace>"
xcode_scheme: "<SchemaName>"
script: xctool -workspace <WorkspaceName.xcworkspace> -scheme <SchemeName> -configuration Release build archive
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
@tarzan
tarzan / .jsbeautifyrc
Last active July 13, 2018 12:43
.jsbeautifyrc
{
// Details: https://github.com/victorporof/Sublime-HTMLPrettify#using-your-own-jsbeautifyrc-options
// Documentation: https://github.com/einars/js-beautify/
"html": {
"brace_style": "collapse", // "expand", "end-expand", "expand-strict"
"indent_char": " ",
"indent_scripts": "keep", // "separate", "normal"
"indent_size": 4,
"max_preserve_newlines": 10,
"preserve_newlines": true,
@supermarin
supermarin / gist:5597771
Last active December 17, 2015 10:49
Testing asynchronous methods with Kiwi
//
// BeerTests.m
// Beer
//
// Created by Marin Usalj on 5/16/13.
// Copyright 2013 @mneorr | mneorr.com. All rights reserved.
//
#import "Kiwi.h"