Skip to content

Instantly share code, notes, and snippets.

View readonly-postgres-users.sql
--------------------------------------------
-- login as superuser
-- use sample_database
-- do not allow users to create tables by default
REVOKE CREATE ON SCHEMA public FROM public;
-- application user
CREATE USER tablecreator;
ALTER USER tablecreator WITH ENCRYPTED PASSWORD 'password';
View mac-file-merge-diff-tool
open /Applications/Xcode.app/Contents/Applications/FileMerge.app/
View misc.txt
------------
for own key, generator of params
------------
http://stackoverflow.com/questions/22001912/prettify-json-output-of-active-model-serializer-in-rails-console?answertab=active#tab-top
puts JSON.pretty_generate(FooSerializer.new(p).serializable_hash)
View can-be.rb
specify { expect(subject).to be_an_instance_of(described_class) }
View no-tables.html
<div class="no-more-tables-container">
<table class="no-more-tables-portrait-only">
<thead>
<tr>
<td>Name</td>
<td>Phone</td>
<td>Email</td>
</tr>
</thead>
<tbody>
View no-tables.scss
// https://css-tricks.com/responsive-data-tables/
// https://css-tricks.com/examples/ResponsiveTables/responsive.php
// http://elvery.net/demo/responsive-tables/
.no-more-tables-container {
@mixin no-more-tables-mixin {
// Force table to not be like tables anymore
table, thead, tbody, th, td, tr {
display: block;
}
View two-tone-calendar-icon-text-all
.two-tone-container {
background-color: #5bc0de;
border-radius: 5px 5px 5px 5px;
.two-tone-content {
padding-left: 10px;
display: inline-block;
color: #fff;
}
View two-tone-calendar-icon-text-calendar
.two-tone-container {
background-color: #5bc0de;
border-radius: 5px 5px 5px 5px;
.two-tone-content {
padding-left: 10px;
display: inline-block;
}
.two-tone-content-cell:before {
@house9
house9 / secure-controller-shared-spec.rb
Created Aug 28, 2015
Shared spec for checking role security for API controller
View secure-controller-shared-spec.rb
shared_examples_for "a secure v1 api" do |endpoints|
endpoints.each do |endpoint|
endpoint.each do |action, data|
http_method = data[:request] || :get
roles = data[:roles] || []
roles << 'admin'
parameters = (data[:with] || {}).merge(format: 'json')
describe "#{http_method}: #{action}" do
User::ROLES.each do |role|
View run-pairs.bat
set PAIR_SIZE=3
ruby pairs.rb people.txt
set /p=Hit Enter to quit...