This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module WhitelistMatcher | |
# Checks if all of the specified attributes are mass-assignable, and if all the others are protected. | |
# If used with should_not, then ONLY the specified attributes should be protected from mass assignment, and for all other it should be allowed | |
# (i.e. behavior similar to :except ) | |
# It also supports roles by chaining as() | |
# | |
# it { should whitelist(:email, :password, :password_confirmation) } | |
# it { should_not whitelist(:admin, :balance) | |
# it { should whitelist(:owner).as(:superuser) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
offending_files = %w(.Spotlight-V100 .Trashes ._.Trashes) | |
base_path = "/media/mid/ADATA UFD2/" | |
while true | |
puts "Press enter to attempt to delete stuff.." | |
gets | |
puts "Checking if path exists" | |
if File.exists?( base_path ) | |
puts "Exists, deleting" | |
offending_files.each do |f| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
n = 1000000 | |
Benchmark.bm do |x| | |
x.report("'Old' string concat:"){ n.times{ "Hello, " + "world" } } | |
class String | |
alias_method :old_plus, :+ | |
def +(other) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fg | |
fg | |
sdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module M | |
def foo | |
end | |
end | |
class BaseClass | |
def base_method | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nvidia-xconfig: X configuration file generated by nvidia-xconfig | |
# nvidia-xconfig: version 331.49 (buildmeister@swio-display-x86-rhel47-10) Wed Feb 12 21:00:07 PST 2014 | |
# nvidia-settings: X configuration file generated by nvidia-settings | |
# nvidia-settings: version 310.44 (buildmeister@swio-display-x86-rhel47-07) Wed Mar 27 15:56:09 PDT 2013 | |
Section "ServerLayout" | |
Identifier "Layout0" | |
Screen 0 "Screen0" 0 300 | |
Screen 1 "Screen1" RightOf "Screen0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'shoes' | |
require 'libnotify' | |
Shoes.app do | |
stack do | |
para "Enter your name" | |
flow do | |
name_input = edit_line | |
btn = button "Send" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## probably NOT an optimal way, but this should give +clipboard, +python, +ruby and +xterm_clipboard | |
## tested ONLY on Ubuntu server 14.04 | |
# tools etc | |
sudo apt-get -y install git curl ssh tmux mercurial | |
# libraries for ruby and vim ruby support | |
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion ruby-dev | |
# libs for python vim support |
OlderNewer