Skip to content

Instantly share code, notes, and snippets.

View tweetstorm.swift
// Created by David Smith on 5/29/17.
// Copyright © 2017 Unseen University. All rights reserved.
//
// Localization- and encoding-safe solution to Coraline Ada's challenge here: https://twitter.com/CoralineAda/status/869204799027372032
// Very lightly tested. Probably contains bugs.
import Foundation
func tweetStorm(input uncanonicalizedInput:String, handle:String?) -> [String] {
let input = uncanonicalizedInput.precomposedStringWithCanonicalMapping //twitter requires NFC
@JamieMason
JamieMason / README.md
Last active Feb 25, 2019
Access deeply nested value in JavaScript
View README.md

Access deeply nested value in JavaScript

Loose Version

const complete = {
  foo: {
    bar: {
      baz: 'hello'
    }
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active Jun 25, 2021
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/
View migrate_postgresql_database.md

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

View Trie.swift
//
// Trie.swift
// SceneTest
//
// Created by Greg Titus on 6/7/14.
// Copyright (c) 2014 The Omni Group. All rights reserved.
//
// This is essentially the same data structure as OFTrie in OmniFoundation, except that the OmniFoundation version is mutable and ephemeral,
// and this version is immutable and persistent. Every time you add a string to the trie, it replaces all the nodes along the string's path
@Chaser324
Chaser324 / GitHub-Forking.md
Last active Jul 28, 2021
GitHub Standard Fork & Pull Request Workflow
View GitHub-Forking.md

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@ragaskar
ragaskar / aggregates_current_organization.rb
Last active Aug 29, 2015
CloudController Repository Pattern
View aggregates_current_organization.rb
module Aggregate
class CurrentOrganization
attr_reader :organization, :spaces, :account
def initialize(attrs)
@organization = attrs.fetch(:organization)
@spaces = attrs.fetch(:spaces)
@account = attrs.fetch(:account)
end
View gist:9054973
Start every day coding, end every day thinking.
1. Warmup exercise (30 mins)
Make sure to have these ready the night before, pick stuff
that you can work on right away without having to study
in advance.
They can either be book exercises or stuff
from other sources, but they should be self-verifiable