Skip to content

Instantly share code, notes, and snippets.

View robinclart's full-sized avatar

Robin robinclart

View GitHub Profile
@robinclart
robinclart / randomize_sentence.rb
Last active August 29, 2015 13:57
Randomize the content within brackets in the form of [ a | b ]
require "benchmark"
# Originally written by @blazeeboy
# See https://gist.github.com/9429208
def generate(result)
# ...
end
def randomize_sentence(sentence)
randomized_sentence = sentence.gsub(/\[[^\[\]]+\]/) { |s| s[1..-2].split("|").shuffle.first }
@robinclart
robinclart / birthday.rb
Created April 17, 2012 07:01
A module and a class to deal with birthday
require "date"
module Birthday
def birthday(year_of_birthday = Date.today.year)
if birthdate.leap?
year_of_birthday += 1 until Date.new(year_of_birthday).leap?
end
Date.new(year_of_birthday, birthdate.month, birthdate.day)
end
@robinclart
robinclart / casanova.gemspec
Created April 18, 2012 03:48
A class to parse csv document
Gem::Specification.new do |s|
s.name = "casanova"
s.version = "0.1.0"
s.platform = Gem::Platform::RUBY
s.author = "Robin Clart"
s.email = "robin@clart.be"
s.summary = ""
s.description = ""
s.files = ["casanova.rb"]
@robinclart
robinclart / ridiculous.rb
Created August 20, 2012 17:29
ridiculous
require "active_support/all"
require "active_model/naming"
class SuperFoo
A_CONSTANT = 3.14
def greet
puts "Hi! + #{A_CONSTANT}"
end
@robinclart
robinclart / nav.js
Created March 3, 2013 20:02
Navigation highlighting for one page website
(function() {
var Nav;
Nav = (function() {
function Nav(selector) {
this.selector = selector;
this.element = $(this.selector || "[data-nav]").first();
this["class"] = this.element.data("nav");
this.height = this.element.parent().height();

Keybase proof

I hereby claim:

  • I am robinclart on github.
  • I am robinclart (https://keybase.io/robinclart) on keybase.
  • I have a public key whose fingerprint is 21DA B729 A5D1 BBF0 4695 4243 C87F EADB E5FD 594C

To claim this, I am signing this object:

@robinclart
robinclart / .emacs
Created January 5, 2017 03:17
.emacs
(setq scroll-step 1
scroll-conservatively 10000)
(menu-bar-mode -1)
(set-window-margins nil 1)
(setq linum-format "%d ")
@robinclart
robinclart / config
Last active January 5, 2017 03:27
.bundle/config
---
BUNDLE_GEM__COC: false
BUNDLE_GEM__MIT: true
BUNDLE_GEM__TEST: minitest
@robinclart
robinclart / shells
Created January 5, 2017 03:30
etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
@robinclart
robinclart / .gemrc
Created January 5, 2017 04:02
.gemrc
---
gem: --no-ri --no-rdoc