Skip to content

Instantly share code, notes, and snippets.

View msassak's full-sized avatar

Mike Sassak msassak

View GitHub Profile
@msassak
msassak / postgres_queries_and_commands.sql
Created July 13, 2018 20:23 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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%'

Keybase proof

I hereby claim:

  • I am msassak on github.
  • I am msassak (https://keybase.io/msassak) on keybase.
  • I have a public key ASAjH89ED49tJq0n3SVB4nLP0y08oTs2wQC-JDEtM8UfsQo

To claim this, I am signing this object:

(deftest test-with-spy
(let [state (atom [])
spy (fn [& args] (swap! state into (vec args)))]
(with-redefs [foo.bar.ns/side-effecting-fn spy]
(fn-that-calls-side-effecting-fn :foo 1 {:whatever "hi"}))
(is (= [:foo 1 {:whatever "hi"}] @state))))
acc_func(Xs) ->
acc_func(Xs, []).
acc_func([], Acc) ->
lists:reverse(Acc);
acc_func([X|Xs], Acc) ->
acc_func(Xs, [X * 2|Acc]).
(defn acc-func [xs]
(loop [my-xs (seq xs) acc []]
This is a test
%% From "Why Functional Programming Matters" by John Hughes
-module(tree).
-include_lib("eunit/include/eunit.hrl").
-export([fold/4,
map/2]).
-type label() :: any().
-type tree() :: {label(), [tree()]}.
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[36m\]\w\[\033[00m\]$(__git_ps1 "(%s)") \$ '
# This:
respond_to do |format|
format.html do
# generate html
end
format.js do
# generate javascript
end
end
@msassak
msassak / en.rb
Created September 22, 2011 17:05
# line 1 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en.rb.rl"
require 'gherkin/lexer/i18n_lexer'
module Gherkin
module RbLexer
class En #:nodoc:
# line 116 "/Users/ahellesoy/scm/gherkin/tasks/../ragel/i18n/en.rb.rl"
@msassak
msassak / cucumber.feature
Created June 13, 2011 20:16
cucumber.feature
Feature: testing cucumber
Background:
Given a scenario "Thingamabob" with:
"""
Given a thingamabob
When I frobnicate the thingamabob
Then it makes happy kittens
"""
Scenario: