Skip to content

Instantly share code, notes, and snippets.

Avatar

Dalibor Nasevic dalibor

View GitHub Profile
View bitarray.rb
class BitArray
attr_reader :size
attr_reader :field
include Enumerable
VERSION = "2.0.0"
def initialize(size, field = nil)
@size = size
@field = field || "\0" * (size / 8 + 1)
@dalibor
dalibor / Gemfile
Created Mar 1, 2015
Github flavored markdown to HTML
View Gemfile
source 'https://rubygems.org'
gem 'github-markup'
gem 'github-markdown'
gem 'github-linguist'
gem 'html-pipeline'
View gist:b8fad6ccc9e156488ea1
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
View ruby_style_guide
(taken from https://github.com/dkubb/styleguide/)
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
== Formatting:
View gist:5296092

Writing Commit Messages

One line summary (< 50c)

Longer description (wrap at 72c)

Summary

@dalibor
dalibor / gist:5077516
Last active Dec 14, 2015 — forked from bkimble/gist:1365005
List local memcached keys using Ruby
View gist:5077516
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@dalibor
dalibor / CNAME
Created Oct 22, 2012 — forked from vladan/CNAME
JS пликација за пресметување на плати. Во контролерот се вршат пресметките, другото е само приказ. angular.min.js е ставен за да работи сѐ од 1ва.
View CNAME
kalkulator.ot.mk