Skip to content

Instantly share code, notes, and snippets.

@hayderimran7
hayderimran7 / gist:d2e40534016f7f07da44
Created Jul 12, 2015
Solve docker issue "Error mounting devices cgroup: mountpoint for devices not found" on ubuntu
View gist:d2e40534016f7f07da44
I faced this issue when running docker with btrfs. I finally found this link https://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker and solution was at A3.
so perform following as sudo :
> sudo -i
> echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab
> mount /sys/fs/cgroup
now run docker daemon:
@tonycoco
tonycoco / controller_spec.rb
Last active Feb 21, 2020
The Greatest Hits of Rspec Testing: Volume 1
View controller_spec.rb
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
@tomdale
tomdale / gist:4004913
Created Nov 2, 2012
Per-Type Adapters Proposal
View gist:4004913

Per-Type Adapter Hooks

Requirements

Many existing JSON APIs are not consistent between types. As JSON endpoints grew organically and were built by different engineers at different times, the style in which records are represented can vary wildly.

Historically, we have asked adapter authors to rely on the fact that the type of record is provided to all adapter hooks (either by passing a type argument, or by passing a record

View TwoOfThree.sh
# Raw transaction API example work-through
# Send coins to a 2-of-3 multisig, then spend them.
#
# For this example, I'm using these three keypairs (public/private)
# 0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU
# 04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk
# 048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw
# First: combine the three keys into a multisig address:
./bitcoind createmultisig 2 '["0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86","04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a9
@Raven24
Raven24 / Gemfile
Created Sep 14, 2012
website screenshot and comparison generator
View Gemfile
source 'http://rubygems.org'
gem 'selenium-webdriver'
gem 'rmagick'
@hfase01
hfase01 / ruby.sh
Last active Oct 9, 2015
Installs ruby 1.9.3 from source instead of package or RVM.
View ruby.sh
#!/bin/sh
#########
## This script simply installs Ruby 1.9+ from source,
## eliminating the need for RVM or strange packaged versions.
##
## To run this script right from GitHub use the following command.
## **RUN THIS AS ROOT**
##
## ~$ curl https://gist.github.com/hfase01/3444584/raw/ruby.sh | sh
##########
View passwords_controller.rb
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
View gist:2964410
// Sum total of code required to update your app using NSync
var updateManager = new UpdateManager("MyCoolApp", "http://mycoolapp.com/update");
updateManager.UpdateApp()
.Subscribe(
x => Console.WriteLine("Update worked! Now at {0}", x.Version),
ex => Console.WriteLine("No Dice! {0}", ex);
View jquery.insert.js
(function($){
var insertAtCaret = function(value) {
if (document.selection) { // IE
this.focus();
sel = document.selection.createRange();
sel.text = value;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
View jquery.drop.js
(function($){
function dragEnter(e) {
$(e.target).addClass("dragOver");
e.stopPropagation();
e.preventDefault();
return false;
};
function dragOver(e) {
e.originalEvent.dataTransfer.dropEffect = "copy";
You can’t perform that action at this time.