Skip to content

Instantly share code, notes, and snippets.

@kevinkyyro
kevinkyyro / Presentation.sc
Created October 12, 2016 18:04
A code-based presentation of "Don't Fear the Implicits" by Daniel Westheide
// https://speakerdeck.com/dwestheide/dont-fear-the-implicits-everything-you-need-to-know-about-typeclasses
object `Preview: implicits can be used for...` {
trait Dependencies[T] {
import scala.concurrent.{ExecutionContext, Future}
def map[S](f: T => S)(implicit executor: ExecutionContext): Future[S]
}
@vasanthk
vasanthk / System Design.md
Last active May 16, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@debasishg
debasishg / gist:8172796
Last active May 10, 2024 13:37
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@henrik
henrik / authentication.rb
Created September 10, 2013 14:24
A precursor of http://github.com/henrik/autho. Simple Rails-less authentication model. Assumes an API compatible with ActiveRecord and Rails' has_secure_password.
require "bcrypt"
require "attr_extras"
class Authentication
pattr_initialize :finder, :email, :password
def self.digest(unencrypted_password)
BCrypt::Password.create(unencrypted_password)
end
# https://github.com/barsoom/attr_extras
require "attr_extras"
class UserSession
pattr_initialize :controller, :session_key, :finder
# NOTE: Not memoized yet.
def user
if id
finder.find(id)
@ynaoto
ynaoto / gist:5228280
Last active June 21, 2017 07:23
Install 'mosh' to CentOS 6
rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install mosh –enablerepo=epel
@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@julik
julik / composition-normalization-and-morons.markdown
Created February 17, 2012 09:43
Композиция, нормализация и уроды

В своих разговорах о Юникоде я не затронул несколько интересных моментов, о которых полезно знать. Кофейный столик "Юлик о Юникоде" продолжает прием посетителей.

Байт, кодпойнт, глиф

Юникод - многобайтовый способ кодирования текста. Текст состоит из codepoints (кодовых позиций), все позиции присутствуют в каталоге символов Unicode. Кодпойнты включают базовые компоненты графем и графемы в целом. При этом:

Каждый кодпойнт можно выразить в байтовом виде как минимум 5 разными способами

Один из них - UTF-8, в котором все латинские буквы заменены на однобайтовые ASCII-эквиваленты. Другие варианты - UTF-16 и UTF-32. UTF-16 - стандартный способ хранения Unicode-строк в операционных системах. InDesign импортирует тексты именно в UTF-16 например.

@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o