Skip to content

Instantly share code, notes, and snippets.

View Winslett's full-sized avatar

Christopher Winslett Winslett

View GitHub Profile
@Winslett
Winslett / gist:aafee479257bc64ba5db8d11191ec842
Last active February 6, 2021 02:17
Fun quote opposite-word algorithm
if you are too FALSE to do the TRUE things, then you are too TRUE to do the FALSE things.
if you are too TRUE to do the FALSE things, then you are too FALSE to do the TRUE things.
if you are too above to do the below things, then you are too below to do the above things.
if you are too absent to do the present things, then you are too present to do the absent things.
if you are too abundant to do the scarce things, then you are too scarce to do the abundant things.
if you are too accept to do the decline things, then you are too decline to do the accept things.
if you are too accept to do the refuse things, then you are too refuse to do the accept things.
if you are too accidental to do the intentional things, then you are too intentional to do the accidental things.
if you are too accurate to do the inaccurate things, then you are too inaccurate to do the accurate things.
if you are too admit to do the deny things, then you are too deny to do the admit things.
@Winslett
Winslett / projects.zsh
Last active March 13, 2024 15:53
Pretty Project Directories
compdef _p p
function _p () {
_files -W /Users/`whoami`/Projects/ -
return 1
}
function p () {
if [[ $1 == 'open' ]]; then
REPLACEMENT="s/\\/Users\\/`whoami`\\/Projects\\///g"
#!/usr/bin/env ruby
# construct the array of possibilities
def construct_board(board)
unknown_count = 0
board.each_with_index do |row, row_index|
row.each_with_index do |cell_value, column_index|
if cell_value.nil?
board[row_index][column_index] = (1..9).to_a

Keybase proof

I hereby claim:

  • I am winsletts on github.
  • I am winslett (https://keybase.io/winslett) on keybase.
  • I have a public key ASC1e7be3Ddlb0sI7WSEbwpbzvy92l8XsnBdb1qyRZe5RQo

To claim this, I am signing this object:

@Winslett
Winslett / keybase.md
Created April 27, 2018 12:37
keybase.md

Keybase proof

I hereby claim:

  • I am winsletts on github.
  • I am winslett (https://keybase.io/winslett) on keybase.
  • I have a public key ASC1e7be3Ddlb0sI7WSEbwpbzvy92l8XsnBdb1qyRZe5RQo

To claim this, I am signing this object:

#!/bin/sh
# branch from https://gist.github.com/pozorvlak/8784840
# Suppose you want to do blind reviewing of code (eg for job interview
# purposes). Unfortunately, the candidates' names and email addresses are
# stored on every commit! You probably want to assess each candidate's version
# control practices, so just `rm -rf .git` throws away too much information.
# Here's what you can do instead.
@Winslett
Winslett / gist:8e0ab9066d4888ee760e
Last active August 29, 2015 14:24
ruby-pg connection retry from PG::UnableToSend
uri = URI.parse(ENV['POSTGRES_URL'])
$query_postgres = lambda do |sql|
begin
$postgres ||= PG.connect(uri.hostname, uri.port, nil, nil, uri.path[1..-1], uri.user, uri.password)
$postgres.exec(sql)
rescue PG::UnableToSend
$postgres = nil
retry
end
1. Eat Bi-Rite ice cream in Dolores Park
2. Tan yourself with other hip San Francisco residents at Dolores Park
3. Visit Bi-Rite grocery store in the Mission
4. Visit Golden Gate park and climb to the top of the DeYoung Museum
5. Stare at beautiful art at the San Francisco Museum of Modern Art (“SFMoMA”)
6. Window shop on Valencia St in The Mission - start at 16th and Valencia and walk to 25th and Valencia
7. Visit the Ferry Building Farmers Market (on Saturdays) under the Bay Bridge
8. Take a cable car on the California Line to Pac Heights and meander back down Fillmore St
9. Eat dim-sum in the largest China Town in the USA (Koi Palace in Daly City which is South of San Francisco is considered excellent for this)
10. See a concert at the Great American Music Hall
@Winslett
Winslett / gist:6a674ae858ab92f13038
Created April 13, 2015 20:15
Ruby Binary Search
require 'benchmark'
class Data
class << self
@@key_values = {}
def put(key, value, time)
@@key_values[key] ||= []
@@key_values[key] << {time: time, value: value}
true
@Winslett
Winslett / gist:5010481
Last active December 14, 2015 01:59
Mongoid Sample
production:
sessions:
default:
uri: mongodb://<username>:<password>@<host>:<port>/<database_name>
options:
skip_version_check: true
consistency: :strong
safe: true
max_retries: 30
retry_interval: 1