This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Apollo | |
public struct KCal: JSONDecodable, JSONEncodable { | |
let value: Double | |
public init(jsonValue value: Apollo.JSONValue) throws { | |
guard let value = value as? Double else { throw JSONDecodingError.wrongType } | |
guard (value.isZero || value.isNormal) && value >= 0.0 else { throw JSONDecodingError.couldNotConvert(value: value, to: KCal.self) } | |
self.value = value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Playground - noun: a place where people can play | |
import Cocoa | |
let a = [1, 2, 3] | |
var b = a | |
a === b // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_rds_cluster" "default" { | |
cluster_identifier = "${var.service}-${var.name}-${var.env}" | |
master_username = "${var.username}" | |
master_password = "${var.password}" | |
backup_retention_period = 5 | |
preferred_backup_window = "19:30-20:00" | |
preferred_maintenance_window = "wed:20:15-wed:20:45" | |
port = 3306 | |
vpc_security_group_ids = ["${var.security_group_ids}"] | |
db_subnet_group_name = "${var.subnet_group_name}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var projects = [ | |
['githubuser/repo1', 'circleci_api_token_for_repo1'], | |
['githubuser/repo2', 'circleci_api_token_for_repo2'], | |
]; | |
var https = require('https') | |
var callApi = function(method, path, body, callback) { | |
var options = { | |
hostname: 'circleci.com', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
SUBL_COMMAND = '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' | |
require 'pathname' | |
def base_dir | |
return @base_dir if @base_dir | |
return @base_dir = Pathname.new('.') if ARGV.empty? | |
input = Pathname.new(ARGV[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on alfred_script(q) | |
tell application "iTerm" to (create window with default profile) | |
end alfred_script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https') | |
exports.handler = function(event, context) { | |
var options = { | |
hostname: 'circleci.com', | |
path: '/api/v1/project/${user|org}/${project}/tree/master?circle-token=${token}', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=readlines.map(&:strip).map(&:each_char).map(&:to_a) | |
a[0]+=([nil]*100) | |
puts a[0].zip(*a[1..-1]).flatten.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dispatch._ | |
import com.ning.http.client.filter.{ ResponseFilter, FilterContext } | |
import scala.collection.JavaConverters._ | |
val MyHttp = Http.configure { builder => | |
builder.addResponseFilter(new ResponseFilter { | |
override def filter(ctx: FilterContext[_]) = { | |
ctx.getResponseHeaders.getHeaders.get("Content-Type").asScala.toList match { | |
case "text/html" :: Nil => | |
ctx.getResponseHeaders.getHeaders.put("Content-Type", List("text/html; charset=utf-8").asJava) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
remove_dangling() { | |
echo "Removing dangling images ..." | |
docker rmi $(docker images -f dangling=true -q) | |
} | |
remove_stopped_containers() { | |
echo "Removing stopped containers ..." | |
docker rm $(docker ps -qa) |
NewerOlder