Download from here:
MD5: 59bab8f71f8c096cd3f72cd73851515d
Rename it to: Sublime Text
Make it executable with: chmod u+x Sublime\ Text
| require 'digest' | |
| # Get SHA256 Hash of a file | |
| puts Digest::SHA256.hexdigest File.read "data.dat" | |
| # Get MD5 Hash of a file | |
| puts Digest::MD5.hexdigest File.read "data.dat" | |
| # Get MD5 Hash of a string | |
| puts Digest::SHA256.hexdigest "Hello World" | |
| # Get SHA256 Hash of a string using update |
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| # By Uğur Özyılmazel, @vigobronx | @ugurozyilmazel | |
| # http://vigodome.com | http://ugur.ozyilmazel.com | http://github.com/vigo | |
| def get_paged_memory_usage(match_string, paging=4096) | |
| mvar = 3 | |
| if match_string.split(/[^\w]/).length > 1 | |
| mvar = 4 |
| // Intercepting HTTP calls with AngularJS. | |
| angular.module('MyApp', []) | |
| .config(function ($provide, $httpProvider) { | |
| // Intercept http calls. | |
| $provide.factory('MyHttpInterceptor', function ($q) { | |
| return { | |
| // On request success | |
| request: function (config) { | |
| // console.log(config); // Contains the data about the request before it is sent. |
Download from here:
MD5: 59bab8f71f8c096cd3f72cd73851515d
Rename it to: Sublime Text
Make it executable with: chmod u+x Sublime\ Text
| # Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
| describe 'Modal' do | |
| should 'display login errors' do | |
| visit root_path | |
| click_link 'My HomeMarks' | |
| within '#login_area' do | |
| fill_in 'email', with: '[email protected]' | |
| fill_in 'password', with: 'test' |
| INSTALL | |
| ======= | |
| $ gem install rspec | |
| RSPEC-RAILS | |
| =========== | |
| RAILS-3 | |
| ======= |
| # http://unicorn.bogomips.org/SIGNALS.html | |
| rails_env = ENV['RAILS_ENV'] || 'production' | |
| rails_root = ENV['RAILS_ROOT'] || "/data/github/current" | |
| God.watch do |w| | |
| w.name = "unicorn" | |
| w.interval = 30.seconds # default | |
| # unicorn needs to be run from the rails root |
| # This will ride alongside god and kill any rogue memory-greedy | |
| # processes. Their sacrifice is for the greater good. | |
| unicorn_worker_memory_limit = 300_000 | |
| Thread.new do | |
| loop do | |
| begin | |
| # unicorn workers | |
| # |
| # Taken from passenger_memory_stats script | |
| # Returns the private dirty RSS for the given process, in KB. | |
| def determine_private_dirty_rss(pid) | |
| total = 0 | |
| File.read("/proc/#{pid}/smaps").split("\n").each do |line| | |
| line =~ /^(Private)_Dirty: +(\d+)/ | |
| if $2 | |
| total += $2.to_i | |
| end |