Skip to content

Instantly share code, notes, and snippets.

View listrophy's full-sized avatar

Brad Grzesiak listrophy

View GitHub Profile
@listrophy
listrophy / postgres.sh
Last active June 26, 2018 16:18 — forked from mrw34/postgres.sh
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -eu -o pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key
# insert the following argument if you want to expose a different port for postgres:
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=local
@listrophy
listrophy / mockingbird.rb
Created October 9, 2012 23:20
Mockingbird example
class Mockingbird < ActiveRecord::Base
attr_accessible :color
def chirp!
"chirp"
end
def tweet!
"tweet"
end
<!DOCTYPE html>
<html>
<head>
<%= stylesheet_link_tag 'tt_report', :plugin => 'redmine_time_tracker', :media => "all" %>
<%= javascript_include_tag 'mootools/mootools-core-1.4.5-full-compat-yc.js', :plugin => 'redmine_time_tracker' %>
<%= javascript_include_tag 'mootools/mootools-more-1.4.0.1.js', :plugin => 'redmine_time_tracker' %>
<%= javascript_include_tag 'MilkChart.yc.js', :plugin => 'redmine_time_tracker' %>
</head>
<body>
<table style="width: 100%;">
:%s/{/(/g|%s/}/)/g
jr}w./[
r{jj.kF(r[f)r]ZZ
scope :latest_by_hashtag, lambda {|hashtag| {
:where => { :hashtags => hashtag },
:order_by => :tweeted_at.desc,
:limit => 20 }
}
# OR #
module MyModelModules
module Scopes