Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@flavorjones
flavorjones / _output.txt
Created June 7, 2016 15:10
benchmark nokogiri vs rexml
# parsing a document 6731 bytes long
Warming up --------------------------------------
nokogiri 488.000 i/100ms
rexml 21.000 i/100ms
Calculating -------------------------------------
nokogiri 6.150k (±23.4%) i/s - 28.792k in 5.067345s
rexml 208.195 (± 5.3%) i/s - 1.050k in 5.056578s
Comparison:
nokogiri: 6150.3 i/s
@yang-wei
yang-wei / destructuring.md
Last active November 3, 2024 16:23
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active November 10, 2024 20:52
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

@zlargon
zlargon / remove_malware.sh
Last active February 15, 2017 15:08
Remove unwanted adware that displays pop-up ads and graphics on your Mac. https://support.apple.com/en-us/HT203987
#!/bin/bash
echo "Remove unwanted adware that displays pop-up ads and graphics on your Mac"
echo "https://support.apple.com/en-us/HT203987"
echo ""
# 1. Downlite, VSearch, Conduit, Trovi, MyBrand, Search Protect, Buca Apps
echo "1. Remove Downlite, VSearch, Conduit, Trovi, MyBrand, Search Protect, Buca Apps"
echo ""
malware[0]="/System/Library/Frameworks/v.framework"
malware[1]="/System/Library/Frameworks/VSearch.framework"
@loceee
loceee / AdwareExt.py
Last active September 29, 2016 05:20
AdwareRemover - thanks shea
#!/usr/bin/python
"""Identify or remove files known to be involved in Adware/Malware
infection.
Most of the code applies to building a list of malware files. Thus,
both extension attribute and removal handling are included.
Cleans files as a Casper script policy; thus, it expects four total
arguments, the first three of which it doesn't use, followed by
--remove
@JoshCheek
JoshCheek / option_parser_example.rb
Created February 8, 2015 09:27
Why I will not use Ruby's OptionParser
# Have to hijack the global environment, b/c that's how invasive it is!
def self.wtf
to_return = {exception: nil, stdout: nil, stderr: nil}
require 'stringio'
$stdout = StringIO.new
$stderr = StringIO.new
to_return[:returned] = yield
rescue Exception
to_return[:exception] = $!
ensure
@rxaviers
rxaviers / gist:7360908
Last active November 16, 2024 07:02
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@chischaschos
chischaschos / shortest_path_spec.rb
Created October 29, 2013 22:26
dijkstra shortest path in ruby
require 'spec_helper'
SP = ->(graph, from_node, to_node, nodes = Hash.new(0), visited = [], i = 0) {
return nodes[from_node] if from_node == to_node
neighbours = graph[from_node].reject {|k, v| visited.include?(k) }
neighbours.each do |k, v|
if nodes[k] == 0 || nodes[from_node] + v < nodes[k]
nodes[k] = nodes[from_node] + v
@eprothro
eprothro / communication via narrative.md
Last active September 25, 2024 21:28
Connextra, Gherkin, and Free-form prose for multidisciplinary communication via narrative.

Overview

Getting clients, managers, project managers, designers, and developers on the same page when it comes to feature expectations is hard. Everyone speaking the same language (literally) can go a long way to achieving the same, metaphorically.

There are three common formats that are great for written and verbal communication between stakeholders with different backgrounds, responsibilities, and risk exposures. They are each natural-language, narrative formats (they use plain english) that anyone can understand, but their structrued nature is proven to help clearly communicate behavior, specify intent and synchronize expectations.

Connextra user stories

  • Great for high level feature description
  • Typically bad for detailed behavior description