Skip to content

Instantly share code, notes, and snippets.

View djrobby's full-sized avatar

Robby Dhillon djrobby

  • Detroit, MI - USA
View GitHub Profile
@den-crane
den-crane / AggregatingMergeTree-event-enrichment
Last active May 8, 2024 10:57
AggregatingMergeTree-event-enrichment
CREATE TABLE states_raw(
d date,
uid UInt64,
first_name String,
last_name String,
modification_timestamp_mcs DateTime64(3) default now64(3)
) ENGINE = Null;
CREATE TABLE final_states_by_month(
d date,
https://github.com/rubocop-hq/ruby-style-guide
https://redisgreen.net/blog/pubsub-howto/ - redis pubsub
https://www.brianstorti.com/understanding-ruby-idiom-map-with-symbol/
https://www.youtube.com/watch?v=gIEMKOI_Y-4&t=1s - ruby 24 trics and tips
https://stackoverflow.com/questions/14881125/what-does-to-proc-method-mean
http://maximomussini.com/posts/ruby-to_proc/
https://bparanj.gitbooks.io/ruby-basics/content/part2/binding.html
https://www.reddit.com/r/ruby/comments/981kjw/10_ruby_tricks_we_should_use_to_improve_the_code/
https://www.driftingruby.com/episodes/random-ruby-tips-and-tricks
http://www.virtuouscode.com/2013/12/25/exception-causes-in-ruby-2-1/
@lmj0011
lmj0011 / rejson-for-ubuntu.md
Last active November 4, 2024 10:18
Building and Loading the ReJSON v1 Module on Linux Ubuntu 16.04 for Redis

make sure you have at least redis v4.0+

redis-server --version

redis-cli --version

install the build-essential package

apt-get install build-essential

@jgaskins
jgaskins / app.rb
Last active August 15, 2020 02:34
API app with Roda
require 'authentication'
class MyApp < Roda
include Authentication
plugin :json
route do |r|
r.on('docs') { r.run Docs }
@schweigert
schweigert / Embedding GoLang into a Ruby application.md
Last active April 11, 2025 19:24
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@shaps80
shaps80 / AVPlayer+Scrubbing.swift
Last active April 29, 2025 23:50
Enables smooth frame-by-frame scrubbing (in both directions) – similar to Apple's applications.
public enum Direction {
case forward
case backward
}
internal var player: AVPlayer?
private var isSeekInProgress = false
private var chaseTime = kCMTimeZero
private var preferredFrameRate: Float = 23.98
@Nitesh9952
Nitesh9952 / README.md
Last active April 4, 2020 19:32
Code Refactoring | Rails

Refactoring code is an important part of software development and there are many opportunities for refactoring in the Reflektive codebase. In this challenge, you will be presented with a complicated controller action that could benefit from refactoring.

The application is a typical e-commerce app. The controller action you will be refactoring is the order creation endpoint OrdersController#create.

Data model overview

For our application, we have Products with a price attribute. We have shopping Carts that have many Products through the OrderedItems join table. An OrderedItem belongs_to a Cart and a Product. It has a quantity attribute to keep track of the number of products ordered.

The OrderedItem also belongs_to an Order. This association will be made upon checkout when it's associated with an Order.

@highgain86j
highgain86j / nginx config for icecast2
Last active February 3, 2023 13:06
nginx configuration for reverse-proxying icecast2 streaming server.
server {
listen 80;
listen [::]:80;
server_name radio.example.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
location / {