Skip to content

Instantly share code, notes, and snippets.

@hersha
hersha / ruby-heredoc-highlighting
Created August 10, 2016 22:21
Ruby HEREDOC highlighting
let s:bcs = b:current_syntax
unlet b:current_syntax
syntax include @SQL syntax/sql.vim
" this unlet instruction is needed
" before we load each new syntax
unlet b:current_syntax
syntax include @SHELL syntax/sh.vim
let b:current_syntax = s:bcs
@hersha
hersha / .tmux.conf
Created March 15, 2016 18:17
Fix mouse scroll in tmux 2.1
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
require 'openssl'
class MessageEncryptor
class << self
include OpenSSL
def delivering_email(message)
encrypted_message = sign_and_encrypt(message.encoded, message.to)
overwrite_body(message, encrypted_message)
overwrite_headers(message, encrypted_message)
@hersha
hersha / .gitignore
Created November 9, 2012 20:11
.gitignore for empty directory
#Ignore everything in this directory
*
# Except this file
!.gitignore
@hersha
hersha / Lines.rb
Created November 2, 2012 18:40 — forked from thepleb/Lines.rb
Line Chart for lazy_high_charts
# In the controller
@lineChart = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:chart][:defaultSeriesType] = "line"
f.options[:title][:text] = "Chart Title"
f.xAxis(:categories=>['Jan', 'Feb', 'March', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
f.series(name: 'This Series', :data=> [1,2,3,4,5,6,7,8,9,10,9,8])
f.series(name: 'That Series', :data=> [10,9,8,7,5,6,7,8,9,10,9,8])
end
@hersha
hersha / barfu.rb
Created November 2, 2012 16:12 — forked from thepleb/barfu.rb
highcharts stacked bar graph
## use lazy_high_charts to make a horizontal stacked bar chart
# in the controller
@h = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:chart][:defaultSeriesType] = "bar"
f.options[:title][:text] = "Sample Title Text"
f.legend(:reversed => 'true')
f.xAxis(:categories=>['Cat1',
'Cat2',
'Cat3',
@hersha
hersha / timeout.rb
Created June 5, 2012 16:55
GodRB timeout condition
module God
module Conditions
class Timeout < PollCondition
attr_accessor :timeout
def initialize
super
@last_time = Time.now
end
def reset