Skip to content

Instantly share code, notes, and snippets.

View orend's full-sized avatar

Oren Dobzinski orend

View GitHub Profile
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active November 16, 2024 05:08
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@jklmli
jklmli / gist:4b50e1c6c2720b42bc5d
Last active August 29, 2015 14:24
Get most recent branches in git
git for-each-ref --sort='-authordate:relative' --format='%(color:red)%(objectname:short) %(color:white)- %(color:yellow)(%(refname:short)) %(color:white)%(subject) %(color:green)(%(authordate:relative)) %(color:bold blue)<%(authorname)>' refs/heads | more -R`
# Or in `.gitconfig / [alias]`,
rec = !git for-each-ref --sort='-authordate:relative' --format='%(color:red)%(objectname:short) %(color:white)- %(color:yellow)(%(refname:short)) %(color:white)%(subject) %(color:green)(%(authordate:relative)) %(color:bold blue)<%(authorname)>' refs/heads | more -R
@akiatoji
akiatoji / Clojure_on_RaspberryPi_OSX.md
Last active December 3, 2022 21:15
Running Clojure on Raspberry Pi with OS X

Clojure on Raspberry Pi with OS X

"Clojure running on Raspberry Pi" sounded so cool that I just had to give it a try.

Install JDK

  • Download ARM JDK from Oracle and instlal on Raspberry Pi
  • Change visudo to contain the following
@thatrubylove
thatrubylove / gol.rb
Last active August 29, 2015 14:01
Functional Game of Life (spike)
require 'curses'
module Seeder
extend self
def generate_matrix
rand(40..200).times.map { [rand(24), rand(48)] }
end
end
class Universe

Let me explain what we're trying to do, which may be crazy. But if it's not crazy, perhaps someone can tell us how to use AMQP to do it.

We have a Rails app that talks to a growing number of backend Clojure services.

It could talk to them via HTTP, but many of the messages don't need to be synchronous. They're "fire and forget". Hence AMQP.

For the synchronous messages, we observed two things:

  • Serializing and deserializing HTTP is surprisingly annoying, especially given Rails conventions.

  • Most of the time when we send a message that updates a resource, we don't need a synchronous acknowledgement right away. We only need to know that the update has happened at some point before we next read the resource.

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@jhrr
jhrr / Functional Core, Imperative Shell
Last active January 8, 2018 16:11
Notes and links for ideas about Gary Bernhardt's "functional core, imperative shell"
http://www.infoq.com/presentations/Simple-Made-Easy
http://www.infoq.com/presentations/integration-tests-scam
http://blog.thecodewhisperer.com/2010/09/14/when-is-it-safe-to-introduce-test-doubles
http://youtu.be/yTkzNHF6rMs
http://pyvideo.org/video/1670/boundaries
http://skillsmatter.com/podcast/ajax-ria/enumerators
http://alistair.cockburn.us/Hexagonal+architecture
http://c2.com/cgi/wiki?PortsAndAdaptersArchitecture
http://www.confreaks.com/videos/977-goruco2012-hexagonal-rails
http://www.confreaks.com/videos/1255-rockymtnruby2012-to-mock-or-not-to-mock
@bgswan
bgswan / mailing_list_spec.rb
Last active December 24, 2015 15:19
Alternative version of test described here http://re-factor.com/blog/2013/09/27/slow-tests-are-the-symptom-not-the-cause/ using domain model rather than "service object"
describe MailingList do
let(:notifications) { double('notifications') }
let(:user) { User.new }
it 'registers a new user' do
expect(notifications).to receive(:call).with(user, 'list_name')
mailing_list = MailingList.new('list_name', notifications)
mailing_list.add(user)