Skip to content

Instantly share code, notes, and snippets.

View shybovycha's full-sized avatar

Artem Shubovych shybovycha

View GitHub Profile
import threadpool
# Array needs explicit size to work, probably related to issue #2287
const a: array[0..5, int] = [1,2,3,4,5,6]
proc f(n) = echo "Hello ", n
proc main =
parallel:
for i in countup(0, a.high-1, 2):
@shybovycha
shybovycha / README.md
Last active December 20, 2015 23:09 — forked from killercup/README.md

You have your Rails Apps with specific Gemsets in RVM.

The following commands creates a wrapped unicorn_rails bin. Be sure to replace the variables and that you have unicorn in your bundle.

> rvmsudo rvm wrapper [RUBY VERSION]@[GEMSET] [GEMSET] unicorn_rails

Now you have a /usr/local/rvm/bin/[GEMSET]_unicorn_rails I will refer to [GEMSET]_unicorn_rails as [WRAPPED_NAME]

@shybovycha
shybovycha / png_normalizer.rb
Last active December 15, 2015 03:49 — forked from AquaGeek/png.rb
# Helper method to fix Apple's stupid png optimizations
# Adapted from:
# http://www.axelbrz.com.ar/?mod=iphone-png-images-normalizer
# https://github.com/peperzaken/iPhone-optimized-PNG-reverse-script/blob/master/Peperzaken/Ios/DecodeImage.php
# PNG spec: http://www.libpng.org/pub/png/spec/1.2/PNG-Contents.html
require 'zlib'
require 'stringio'
module PngNormalizer
@shybovycha
shybovycha / mobile_detector.rb
Created November 14, 2012 13:53 — forked from tubalmartin/mobile_detector.php
Lightweight detector of mobile devices, OSs & browsers (Ruby)
class MobileDetector
# pass request.env for Rails 3.2
def initialize(headers)
@headers = headers
end
def get_mobile_os
regexps = {
#mobile OSs
'ios' => 'ip(hone|ad|od)',