Skip to content

Instantly share code, notes, and snippets.

Ryan Montgomery rmontgomery429

Block or report user

Report or block rmontgomery429

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View other.rb
class Other
def perform(package)
puts package
puts "Hello"
rmontgomery429 / secret_secrets.rb
Created Nov 30, 2018
Create hidden values with zero width html entities
View secret_secrets.rb
class SecretSecrets
def self.encode(message)
message.unpack(BINARY_FORMAT).first.split('').map do |bit|
case bit
when '0' then ZERO_WIDTH_JOINER
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
rmontgomery429 / hash.rb
Created Jul 31, 2017
Convert values in hash to be encoded as utf-8 or replace them if invalid or undefined
View hash.rb
class Hash
def to_utf8
map do |k, v|
if v.respond_to?(:to_utf8)
[k, v.to_utf8]
elsif v.respond_to?(:encode)
rmontgomery429 /
Last active Mar 18, 2016
Upgrade ember-cli to the latest release
# Depends on `curl`, `jq`, `npm`, `bower`.
tag_name=$(curl -s | jq -r '.tag_name')
npm uninstall -g ember-cli
npm cache clean
rmontgomery429 / stmp
Created Apr 22, 2015
Send a timestamp to your clipboard
View stmp
#!/usr/bin/env ruby -w
`printf '#{"%d-%b-%Y-%H-%M").upcase}' | pbcopy`
rmontgomery429 / application.html
Last active Aug 29, 2015
Get md5 of application.css
View application.html
<link rel="stylesheet" href="/application-{{application.css|md5}}.css">
View serve.go
package main
import "net/http"
// run `go run serve.go` and navigate to http://localhost:8080/
func main() {
println("Go to http://localhost:8080/")
panic(http.ListenAndServe(":8080", http.FileServer(http.Dir("./public"))))
View gist:edd61c29c3fd794e45ed
package security
import (
// BasicAuth Middleware with next handler in chain
type BasicAuth struct {
You can’t perform that action at this time.