Skip to content

Instantly share code, notes, and snippets.

walkermatt / fizzbuzz.clj
Last active Jul 12, 2017
fizzbuzz without conditionals in Clojure
View fizzbuzz.clj
;; fizzbuzz without conditionals in Clojure
; Simple patten matching using a single map lookup
(defn fizzbuzz [x]
(let [v [(= (mod x 3) 0) (= (mod x 5) 0)]]
({[true false] "fizz"
[false true] "buzz"
[true true] "fizzbuzz"
[false false] x} v)))
nolanlawson / protips.js
Last active Nov 19, 2022
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
dougireton /
Last active Jan 11, 2020
I've started responding to recruiters with this list of requirements

Company Requirements

I'm definitely not looking for work. However to provide some helpful guidance for hiring like-minded engineers, I would only consider working for a company if it met these requirements:

  1. Fewer than 250 employees.
  2. Concrete, measurable plan to increase the number of women and minorities in engineering roles.
  3. Commitment to using and contributing to open source.
  4. Collaborative, friendly atmosphere where pair programming is encouraged.
  5. Meaningful work with clear linkage between work and company goals.
  6. Demonstrated commitment to ethical business practices, e.g. B corp certification.
View ArrayHelpers.swift
extension Array {
func first() -> Element? {
if isEmpty {
return nil
return self[0]
func last() -> Element? {
denji /
Last active Oct 22, 2022 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm
aras-p / preprocessor_fun.h
Last active Nov 22, 2022
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
PrimaryFeather / Polygon.h
Last active Dec 16, 2015
An example for a custom display object for the Sparrow Framework.
View Polygon.h
#import "SPDisplayObject.h"
@interface Polygon : SPDisplayObject
- (id)initWithRadius:(float)radius numEdges:(int)numEdges color:(uint)color;
- (id)initWithRadius:(float)radius numEdges:(int)numEdges;
@property (nonatomic, assign) int numEdges;
@property (nonatomic, assign) float radius;
@property (nonatomic, assign) uint color;
sekati /
Created Jul 24, 2012
Xcode Auto-increment Build & Version Numbers
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)