Skip to content

Instantly share code, notes, and snippets.

--------------------------------------------
-- 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';
open /Applications/Xcode.app/Contents/Applications/FileMerge.app/
------------
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)
specify { expect(subject).to be_an_instance_of(described_class) }
<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>
// 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;
}
.two-tone-container {
background-color: #5bc0de;
border-radius: 5px 5px 5px 5px;
.two-tone-content {
padding-left: 10px;
display: inline-block;
color: #fff;
}
.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 August 28, 2015 19:48
Shared spec for checking role security for API controller
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|
set PAIR_SIZE=3
ruby pairs.rb people.txt
set /p=Hit Enter to quit...