Skip to content

Instantly share code, notes, and snippets.

@kirs
kirs / interuptible.rb
Last active October 21, 2022 10:35
Interruptible jobs
require 'bundler/inline'
gemfile do
source "https://rubygems.org"
gem "resque"
gem "pry"
gem "activerecord"
gem 'mysql2'
end
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
test('I cant handle timeouts', async () => {
await timeout(1);
})
hash: 958b342b0ca650445b8069b4e22032bea2a57aa794a8a4df49b96a3acb5ad443
updated: 2017-03-02T15:43:19.731397794-05:00
imports:
- name: cloud.google.com/go
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
subpackages:
- compute/metadata
- internal
- name: github.com/blang/semver
version: 31b736133b98f26d5e078ec9eb591666edfd091f
@kirs
kirs / compare.rb
Last active February 26, 2017 00:54
require 'benchmark/ips'
collection = 100.times.map { rand(10) }
TABLE = {
6 => true,
7 => true,
8 => true,
9 => true,
11 => true
@kirs
kirs / out
Created February 20, 2017 16:05
Compiling unicode-xid v0.0.4
Compiling winapi-build v0.1.1
Compiling utf8-ranges v0.1.3
Compiling libc v0.2.20
Running `rustc --crate-name unicode_xid /Users/kir/.cargo/registry/src/github.com-1ecc6299db9ec823/unicode-xid-0.0.4/src/lib.rs --crate-type lib -C opt-level=3 --cfg feature=\"default\" -C metadata=f45192a71fffe946 -C extra-filename=-f45192a71fffe946 --out-dir /Users/kir/Projects/opensource/diesel_start/target/release/deps --emit=dep-info,link -L dependency=/Users/kir/Projects/opensource/diesel_start/target/release/deps --cap-lints allow`
Running `rustc --crate-name build /Users/kir/.cargo/registry/src/github.com-1ecc6299db9ec823/winapi-build-0.1.1/src/lib.rs --crate-type lib -C opt-level=3 -C metadata=cfd6f6b28d7441dd -C extra-filename=-cfd6f6b28d7441dd --out-dir /Users/kir/Projects/opensource/diesel_start/target/release/deps --emit=dep-info,link -L dependency=/Users/kir/Projects/opensource/diesel_start/target/release/deps --cap-lints allow`
Running `rustc --crate-name utf
#!/usr/bin/env ruby
# Usage:
# bin/with-magellan bundle exec unicorn
# The binary will execute `bundle exec unicorn` and watch for endpoint status changes in Magellan
require 'net/http'
require 'json'
require "English"
@kirs
kirs / out
Created December 22, 2016 02:11
Unhandled Java exception: java.lang.NoSuchFieldError: SUPPORTS_FENCES
java.lang.NoSuchFieldError: SUPPORTS_FENCES
fullMemoryBarrier at com/concurrent_ruby/ext/SynchronizationLibrary.java:99
call at com/concurrent_ruby/ext/SynchronizationLibrary$JRubyAttrVolatile$INVOKER$s$0$0$fullMemoryBarrier.gen:-1
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:318
call at org/jruby/runtime/callsite/CachingCallSite.java:131
processCall at org/jruby/ir/interpreter/InterpreterEngine.java:340
interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:73
interpret at org/jruby/ir/interpreter/InterpreterEngine.java:84
INTERPRET_METHOD at org/jruby/internal/runtime/methods/InterpretedIRMethod.java:186
# Cleans up branches like:
# if Shopify.rails_next?
# # Rails 5 login
# else
# # Rails 4 login
# end
module RuboCop
module Cop
module ShopifyRails
class RailsNextUnless < Cop
@kirs
kirs / main.c
Created December 1, 2016 17:06
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include <strings.h>
#include "msgpack.h"
#define MSGMAX 256
#define STRING_AND_SIZE(s) (s), (sizeof((s)) - 1)