Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
int dataPin = 2; | |
int clockPin = 3; | |
int csPin = 4; | |
byte chars[] = { | |
B00011000, | |
B00111100, | |
B01100110, | |
B11000011, |
# Let's say you were stupid and used the postgres account for something you | |
# shouldn't have, so you have a database owned by postgres, with all objects | |
# inside owned by postgres. You regain sanity and want to transfer the | |
# ownership to an account that isn't a database superuser. | |
# | |
# In most cases, reassigning ownership is as simple as using | |
# REASSIGNED OWNED. However, that does not work if you are using the | |
# postgres account, so you have to alter the ownership manually. | |
# | |
# First, make sure you connect to the database using the postgres account. |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
class SessionsController < ApplicationController | |
skip_before_filter :verify_authenticity_token, only: :saml | |
def new | |
request = Onelogin::Saml::Authrequest.new | |
settings = saml_settings | |
request_doc = request.create_authentication_xml_doc(settings) | |
request_str = request_doc.to_s #.force_encoding("UTF-8") | |
logger.debug request_str |
# This is the deployment recipe | |
# You require to install runit on the server. | |
# First you need to declare on which port the application will run | |
# | |
# echo 3000 > port | |
# | |
# Then you can setup a new runit service with | |
# | |
# make setup_service | |
# |
# A simple Makefile alternative to using Grunt for your static asset compilation | |
# | |
## Usage | |
# | |
# $ npm install | |
# | |
# And then you can run various commands: | |
# | |
# $ make # compile files that need compiling | |
# $ make clean all # remove target files and recompile from scratch |
after_fork do |server, worker| | |
# Override the default logger to use a separate log for each Unicorn worker. | |
# https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/application/bootstrap.rb#L23-L49 | |
Rails.logger = ActiveRecord::Base.logger = ActionController::Base.logger = begin | |
path = Rails.configuration.paths["log"].first | |
f = File.open(path.sub(".log", "-#{worker.nr}.log"), "a") | |
f.binmode | |
f.sync = true | |
logger = ActiveSupport::TaggedLogging.new(ActiveSupport::BufferedLogger.new(f)) |
/** | |
* WkHtmlToPdf table splitting hack. | |
* | |
* Script to automatically split multiple-pages-spanning HTML tables for PDF | |
* generation using webkit. | |
* | |
* To use, you must adjust pdfPage object's contents to reflect your PDF's | |
* page format. | |
* The tables you want to be automatically splitted when the page ends must | |
* have a class name of "splitForPrint" (can be changed). |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
t = 236 # seconds | |
Time.at(t).utc.strftime("%H:%M:%S") | |
=> "00:03:56" | |
# Reference | |
# http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |