Skip to content

Instantly share code, notes, and snippets.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/aa049a47b218fda30f9a4a454119ae067a02cf50/Formula/postgis.rb
#pg_config --pkglibdir is useful for finding your $libdir
cp -a /usr/local/share/postgresql/extension/postgis* /usr/local/Cellar/[email protected]/9.6.5/share/[email protected]/extension/
cp -a /usr/local/lib/postgresql/postgis-2.3.so /usr/local/Cellar/[email protected]/9.6.5/lib/postgis-2.3
cp -a /usr/local/lib/postgresql/rtpostgis-2.3.so /usr/local/Cellar/[email protected]/9.6.5/lib/
@jacob-beltran
jacob-beltran / object-literals.js
Last active July 30, 2021 02:24
React Performance: Object Literals Example
/*
Object literals or Array literals are functionally equivalent to calling
Object.create() or new Array(). This means that if object literals or
array literals are passed as prop values, React will consider these to be new
values for each render.
This is problematic mostly when dealing with Radium or inline styles.
*/
/* Bad */
@desmondhume
desmondhume / map_to_query_string.ex
Created August 6, 2016 18:13
Convert elixir map to query string
defmodule URL do
def to_query(input, namespace) do
Enum.map(input, fn({key, value}) -> parse("#{namespace}[#{key}]",value)end)
|> Enum.join("&")
end
def to_query(input) do
Enum.map(input, fn({key, value}) -> parse(key,value) end)
|> Enum.join("&")
end
@MarkMurphy
MarkMurphy / README.md
Last active February 17, 2025 09:26
ActiveRecord: Store Milliseconds (or Microseconds) in Timestamps with Rails / MySQL

ActiveRecord: Store Milliseconds (or Microseconds) in DateTimes or Timestamps with Rails / MySQL

Milliseconds in your DateTimes or Timestamps.

We got 'em, you want 'em.

NOTE: only MySQL 5.6.4 and above supports DATETIME's with more precision than a second. For reference see MySQL 5.6.4 Changelog

Why

Shit needs to be PRECISE

@whatsma
whatsma / Vagrantfile
Created January 14, 2016 20:12
Vagrantfle to install chruby, ruby-install, ruby2.3 and the bundler gem
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision :shell, inline: <<-SHELL
# function to run a command as the vagrant user
as_vagrant () {
sudo -i -u vagrant bash -c "$1"
}
sudo apt-get update -y
@cannikin
cannikin / deploy.rb
Last active October 22, 2018 09:02
Notify Sentry of a new release via Capistrano
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
@yuki24
yuki24 / .gitignore
Last active November 9, 2021 16:15
jbuilder vs ActiveModel::Serializers
log/
@Kartones
Kartones / postgres-cheatsheet.md
Last active April 24, 2025 10:22
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@kujohn
kujohn / portforwarding.md
Last active April 3, 2025 15:00
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

@burke
burke / remotepaste.md
Last active April 18, 2025 03:35
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>