Skip to content

Instantly share code, notes, and snippets.

View gist:86c520b600505230eab8ccccb458f9ab
module M
module ClassMethods
def method_a
raise "should not execute method_a"
end
end
def self.included(base)
base.extend M::ClassMethods
end
View gist:c6fb3b57bcd04ee8d653b8bb37eb0b37
contact_faces = ContactFace.where(phone1: phone).or(ContactFace.where(phone2: phone))
let(:book_data) { attributes_for :book }
View gist:d50e81b1dd9bef0f4b253d27fdddf851
sudo su - postgres
# Create dump to file
/usr/pgsql-9.5/bin/pg_dump --no-owner --no-acl some_db > /tmp/some_db
# Import from file
psql --username=root some_db < /tmp/some_db
---------------------------------------------------
sudo su - postgres
psql
CREATE ROLE postgres_user WITH CREATEDB ENCRYPTED PASSWORD 'password' LOGIN; # don't user upcase in role name!
View gist:614b25a1639e4404022b7533d136b815
#!/usr/bin/env ruby
#define path
$:.unshift File.expand_path("../", __FILE__)
require 'rubygems'
require 'eventmachine'
#Faster
require 'em-http'
View gist:616f6e0380a29401743368b4f6052196
'use strict';
app = angular.module('app', [
'ngRoute',
'ngResource',
'templates',
'angularFileUpload'
])
View gist:7190e7bb7dbb26e66be2
color: Qt.rgba(Qt.random(), Qt.random(), Qt.random(), 1)
Button {
id: button
signal pressAndHold()
Timer {
id: longPressTimer