View .spacemacs
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
;; -*- mode: emacs-lisp; lexical-binding: t -*- | |
;; This file is loaded by Spacemacs at startup. | |
;; It must be stored in your home directory. | |
(defun dotspacemacs/layers () | |
"Layer configuration: | |
This function should only modify configuration layer settings." | |
(setq-default | |
;; Base distribution to use. This is a layer contained in the directory | |
;; `+distribution'. For now available distributions are `spacemacs-base' |
View active_admin.rb
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
module AdminPageLayoutOverride | |
def build_page(*args) | |
within super do | |
render "layouts/environment" | |
end | |
end | |
end | |
ActiveAdmin::Views::Pages::Base.send :prepend, AdminPageLayoutOverride |
View gist:9a36fa565683fd61675a003bac335f6b
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
> tsc && npm run minify | |
node_modules/@types/node/index.d.ts:75:11 - error TS2300: Duplicate identifier 'IteratorResult'. | |
75 interface IteratorResult<T> { } | |
~~~~~~~~~~~~~~ | |
node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 | |
41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>; | |
~~~~~~~~~~~~~~ |
View FileWatcherFileListener.swift
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 Foundation | |
fileprivate let queue = DispatchQueue(label: "FileMonitorQueue", target: .main) | |
enum FileWatcherError: Error { | |
case directoryOpenFailed(Int32) | |
case directoryURLInvalid(URL) | |
} | |
final class FileWatcher { |
View gist:614cd09b5c6b3385d634
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
// ProductDelegate | |
import UIKit | |
protocol ProductDelegate: NSObjectProtocol { | |
func didReceiveProduct(product: Product) | |
func didReceiveProductImage(image: UIImage) | |
} | |
// ProductController |
View gist:b988364fcdf6cea4ef05
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
data EventWithDistance = EventWithDistance | |
{ eventWithDistanceId :: Int | |
, eventWithDistanceEndedAt :: LocalTime | |
, eventWithDistanceName :: T.Text | |
, eventWithDistanceStartedAt :: LocalTime | |
, eventWithDistanceUserId :: Int | |
, eventWithDistanceAddress :: T.Text | |
, eventWithDistanceLat :: Float | |
, eventWithDistanceLon :: Float | |
, eventWithDistanceDistance :: Float |
View gist:8da92635eaf5086a480b
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
intOrUppercase = (const () <$> posInt) <|> (const () <$> (satisfy isUpper)) |
View clojure mocks trouble
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
(ns gol-clojure.core-test | |
(:use clojure.contrib.mock) | |
(:require [clojure.test :refer :all] | |
[gol-clojure.core :refer :all])) | |
(deftest new-val-test | |
(testing "new-val" | |
(testing "when the center cell is dead" | |
(testing "with exactly 3 alive neighbors" | |
(let [matrix [[1 1 1] [0 0 0] [0 0 0]]] |
View s3_copy.rb
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
require 'aws-sdk' | |
class S3Copy | |
attr_reader :from_bucket, :to_bucket | |
def initialize(from_bucket, to_bucket) | |
access_key = ENV['AWS_ACCESS_KEY_ID'] | |
secret_key = ENV['AWS_SECRET_ACCESS_KEY'] | |
s3_instance = AWS::S3.new(access_key_id: access_key, secret_access_key: secret_key) |
View fake_attr_accessor
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
# If your options hash is stored in @options | |
attr_accessor :options | |
def method_missing(meth,*args,&prc) | |
if options.keys.include?(meth.to_sym) | |
options[meth.to_sym] | |
elsif options.keys.include?(meth[0...-1].to_sym) && meth[-1] == "=" | |
options[meth[0...-1].to_sym] = args.first | |
else |