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"
end
end
@rmontgomery429
rmontgomery429 / secret_secrets.rb
Created Nov 30, 2018
Create hidden values with zero width html entities
View secret_secrets.rb
class SecretSecrets
BINARY_FORMAT = 'B*'
ZERO_WIDTH_JOINER = '‍'
ZERO_WIDTH_NON_JOINER = '‌'
ZERO_WIDTH_SPACE = '​'
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
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
Hash[
map do |k, v|
if v.respond_to?(:to_utf8)
[k, v.to_utf8]
elsif v.respond_to?(:encode)
[
k,
v.encode(
@rmontgomery429
rmontgomery429 / upembercli.sh
Last active Mar 18, 2016
Upgrade ember-cli to the latest release
View upembercli.sh
#!/bin/sh
##
# Depends on `curl`, `jq`, `npm`, `bower`.
##
tag_name=$(curl -s https://api.github.com/repos/ember-cli/ember-cli/releases/latest | jq -r '.tag_name')
npm uninstall -g ember-cli
npm cache clean
@rmontgomery429
rmontgomery429 / stmp
Created Apr 22, 2015
Send a timestamp to your clipboard
View stmp
#!/usr/bin/env ruby -w
`printf '#{Time.now.strftime("%d-%b-%Y-%H-%M").upcase}' | pbcopy`
@rmontgomery429
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 (
"encoding/base64"
"net/http"
"strings"
)
// BasicAuth Middleware with next handler in chain
type BasicAuth struct {
You can’t perform that action at this time.