Skip to content

Instantly share code, notes, and snippets.

View dalibor's full-sized avatar

Dalibor Nasevic dalibor

View GitHub Profile
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 March 1, 2015 09:26
Github flavored markdown to HTML
source 'https://rubygems.org'
gem 'github-markup'
gem 'github-markdown'
gem 'github-linguist'
gem 'html-pipeline'
@dalibor
dalibor / gist:b8fad6ccc9e156488ea1
Last active December 30, 2020 01:08 — forked from trcarden/gist:3295935
SSL with thin
# 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
@dalibor
dalibor / ruby_style_guide
Created March 27, 2014 09:30
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:

Writing Commit Messages

One line summary (< 50c)

Longer description (wrap at 72c)

Summary

@dalibor
dalibor / gist:5077516
Last active December 14, 2015 11:09 — forked from bkimble/gist:1365005
List local memcached keys using Ruby
#!/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

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dalibor
dalibor / .rspec
Created December 29, 2012 22:34 — forked from coreyhaines/.rspec
--colour
-I app
=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 October 22, 2012 19:27 — forked from vladan/CNAME
JS пликација за пресметување на плати. Во контролерот се вршат пресметките, другото е само приказ. angular.min.js е ставен за да работи сѐ од 1ва.
kalkulator.ot.mk