Skip to content

Instantly share code, notes, and snippets.

View kyrylo's full-sized avatar

Kyrylo Silin kyrylo

View GitHub Profile
@desbo
desbo / quake-3-arena-macos-quickstart-guide.md
Last active August 22, 2022 23:14
Quake 3 Arena macOS quick start guide
  1. Install Q3 fork ioquake3 along with original game patch files (baseq3/pak{1-8}.pk3, missionpack/pak{1-3}.pk3)

    brew cask reinstall ioquake3
    
  2. Build ioquake3 master branch

    git clone https://github.com/ioquake/ioq3
    
@epitron
epitron / -
Created January 15, 2016 09:04
3388 | Why You Should Do A Tiny Product First
| http://unicornfree.com/2013/why-you-should-do-a-tiny-product-first
3494 | Startup Escape Plan: How to free up time, energy & money to build your future
| http://unicornfree.com/2014/startup-escape-plan-free-up-time-energy-money-to-invest
3603 | 5 Years of SaaS Growth: Every Month, Exact Numbers
| http://unicornfree.com/2013/5-years-of-saas-growth-every-month-exact-numbers
3623 | Help! My SaaS isn't growing! +60% revenue, 1 year later…
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
require 'objspace'
class A
# When we include a module, it makes an invisible "included class" (T_ICLASS),
# and places it in the inheritance hierarchy, as the superclass.
# Hence A the inclusion, A no longer has a direct reference to Object,
# it now has a direct reference to the included class
ObjectSpace.reachable_objects_from(self) # => [#<InternalObject:0x007f8cd29343b8 T_CLASS>, "A", Object]
m = Module.new
include m
@JoshCheek
JoshCheek / void_value_expressions.rb
Last active April 11, 2023 14:11
void value expressions make no sense
-> { a = case when true then return end } # this is allowed
-> { a = if true then return end } # this is not
-> { a = if true then return; 2 end } # this is
-> { a = (true && return) } # this is allowed
-> { a = (return && true) } # this is not
-> { a = begin; return
rescue; return
ensure; return
@havenwood
havenwood / sized_queue.rb
Last active December 16, 2015 11:49
SizedQueue Basic Usage
require 'thread'
# Create a SizedQueue with a buffer capacity of just one.
queue = SizedQueue.new 1
# Add four symbols to the SizedQueue. (A SizedQueue is thread-safe just like a
# Queue.)
Thread.new { queue << :of }
Thread.new { queue << :earl }
Thread.new { queue << :and }
@dblack
dblack / gist:3017739
Created June 29, 2012 12:50
weakref behavior
This is from the end of weakref.rb:
if __FILE__ == $0
# require 'thread'
foo = Object.new
p foo.to_s # original's class
foo = WeakRef.new(foo)
p foo.to_s # should be same class
ObjectSpace.garbage_collect
ObjectSpace.garbage_collect
@futuremill-ltd
futuremill-ltd / gist:2318876
Created April 6, 2012 11:00
Building Ruby 1.9.3 package for Debian Squeeze
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193
@cwgem
cwgem / gist:1126294
Created August 4, 2011 21:10
Symbol.to_proc inconsistencies
def mymeth
puts "Hello"
end
puts :mymeth.to_proc.call
#SOLAR:~ chriswhite$ ruby -v
#rubinius 1.2.5dev (1.8.7 1b8a960a yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]
#SOLAR:~ chriswhite$ ruby test_proc.rb
#Hello
@listrophy
listrophy / gist:1065746
Created July 5, 2011 19:55
Using AES in Ruby
require 'openssl'
require 'base64'
secret_message = 'foo!'
aes = OpenSSL::Cipher.new 'AES-256-CBC'
aes.encrypt
iv = aes.random_iv # never EVER use the same IV if you're reusing a key
rnd = aes.random_key