Skip to content

Instantly share code, notes, and snippets.

View dzhulk's full-sized avatar

Murat Dzhulkuttiev dzhulk

  • St. Petersburg, Russia
View GitHub Profile
@dzhulk
dzhulk / cheatsheet.rb
Created July 11, 2024 15:50 — forked from mabenson00/cheatsheet.rb
Rails Postgres ActiveRecord JSON cheatsheet
# Basic key operators to query the JSON objects :
# #> : Get the JSON object at that path (if you need to do something fancy)
# -> : Get the JSON object at that path (if you don't)
# ->> : Get the JSON object at that path as text
# {obj, n} : Get the nth item in that object
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
# Date
# date before today
@dzhulk
dzhulk / The Technical Interview Cheat Sheet.md
Created October 14, 2016 17:28 — forked from kapkaev/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@dzhulk
dzhulk / build.sm
Last active August 29, 2015 14:07 — forked from dmalikov/build.sm
target hw1
sources
hw1.mlb
hw1.main.sml
end
option compiler = mlton
option output = hw1
end
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
import java.lang.Character.{ LETTER_NUMBER => CR,LINE_SEPARATOR => LF }
import java.net.InetSocketAddress
import java.nio.channels.AsynchronousChannelGroup._
import java.nio.channels.AsynchronousServerSocketChannel._
import java.nio.channels.{ AsynchronousSocketChannel => ASC }
import java.nio.channels.CompletionHandler
import java.nio.ByteBuffer._
import java.util.concurrent.Executors._
import scala.annotation.implicitNotFound
import scala.collection.mutable.ListBuffer
@dzhulk
dzhulk / workers.rb
Created November 9, 2012 08:47 — forked from schmurfy/workers.rb
Celluloid workers
require 'celluloid'
WORKERS_COUNT = (ARGV[0] || 1).to_i
class Output
include Celluloid
def puts(msg)
Kernel.puts(msg)
end
@dzhulk
dzhulk / Gemfile
Created November 2, 2012 19:16
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@dzhulk
dzhulk / gist:3958201
Created October 26, 2012 11:01 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@dzhulk
dzhulk / request.rb
Created May 18, 2012 15:24 — forked from steved/request.rb
Eventmachine Deferrable example
require 'httparty'
require 'eventmachine'
class Request
include EM::Deferrable
@@requests = []
attr_reader :method, :params
@dzhulk
dzhulk / config.ru
Created March 2, 2012 11:07
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
require "rails"