Skip to content

Instantly share code, notes, and snippets.

Sebastian Klepper sklppr

View GitHub Profile
@sklppr
sklppr / compare-langs.md
Created Apr 21, 2014
Comparison of simple actions in different languages.
View compare-langs.md

Select all elements in a that are greater than 5 and multiply them by 2.

Ruby

a.select { |x| x > 5 }.map { |x| x * 2 }

a.find_all { |x| x > 5 }.collect { |x| x * 2 }

a.inject([]) { |b, x| x > 5 ? (b << x * 2) : b }
@sklppr
sklppr / coupon.rb
Created Jan 28, 2014
Coupon code generator with customizable number of parts, number of characters per part and separator.
View coupon.rb
def coupon(parts: 4, chars: 4, separator: "-")
SecureRandom.hex(parts*chars/2).upcase.scan(%r/.{#{chars}}/).join(separator)
end
@sklppr
sklppr / markdown2html.rb
Last active Dec 30, 2015 — forked from brentsimmons/generate_html.rb
Batch conversion of Markdown to HTML.
View markdown2html.rb
#!/usr/bin/env ruby
require "fileutils"
require "redcarpet"
OUTPUT_FOLDER = "html"
HTML_TEMPLATE = <<-HTML
<!DOCTYPE html>
<html>
View books-on-design.md

Books on Design

General

Design is a Job (Mike Monteiro)
The Design of Everyday Things (Don Norman)
Emotional Design (Don Norman)
Universal Principles of Design: A Cross-Disciplinary Reference (William Lidwell)
Designed for Use (Lukas Mathis)
The Shape of Design (Frank Chimero)

@sklppr
sklppr / twitter-friends.rb
Created Sep 13, 2012
Fetches info about the people you follow on Twitter and determines who you could/should unfollow.
View twitter-friends.rb
# encoding: utf-8
#####################################################################################
#
# Fetches info about the people you follow on Twitter
# and determines who you could/should unfollow based on:
# - activity: was their last update more than 3 months ago?
# - popularity: do they have less than 25 followers?
# - mass following: are they following more than 10000 people?
View mac-checklist.md

Mac Checklist

Important things when doing a clean install of Mac OS X

Setup

Backup

  • Contacts
  • Calendar
You can’t perform that action at this time.