Skip to content

Instantly share code, notes, and snippets.

extern crate libc;
use libc::size_t;
#[link(name = "snappy")]
extern {
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
}
fn main() {
let x = unsafe { snappy_max_compressed_length(100) };
on_error:
if (why == WHY_NOT) {
if (err == 0 && x != NULL) {
continue; /* Normal, fast path */
}
why = WHY_EXCEPTION;
x = Py_None;
err = 0;
}
/* Double-check exception status */
def main():
try:
other()
except Exception as e:
pass
def other():
raise Exception('woof')
[
{"id": 1, "name": "Alice", "admin": true},
{"id": 4, "name": "Mark", "admin": false}
]
{
"id": 4,
"name": "Mark",
"admin": false,
"photo_url": "https://x.y/z.jpg",
@rokob
rokob / tracker.js
Created July 21, 2017 00:27
Unminified track.js code
//! TrackJS JavaScript error monitoring agent.
//! COPYRIGHT (c) 2017 ALL RIGHTS RESERVED
//! See License at https://trackjs.com/terms/
(function(k, n, m) {
"use awesome";
if (k.trackJs) k.console && k.console.warn && k.console.warn("TrackJS global conflict");
else {
var p = function(a, b, c, d, e) {
this.util = a;
this.onError = b;
@rokob
rokob / gist:755d26de4dabdae66dab
Created February 13, 2015 01:47
fullstory code
var _fs_hash = "29adf5ed17f77f56ed2169dc42e99516";
try {
"undefined" === typeof WeakMap && function() {
var k = Object.defineProperty,
v = Date.now() % 1E9,
a = function() {
this.name = "__st" + (1E9 * Math.random() >>> 0) + (v++ +"__")
};
a.prototype = {
set: function(a, f) {
module A
class B
def shit(x)
puts "I AM THE ORIGINAL #{x}"
x + 1
end
alias_method :oops, :shit
end
end
@rokob
rokob / keybase.md
Created August 14, 2014 17:46
verifying my identity

Keybase proof

I hereby claim:

  • I am rokob on github.
  • I am rokob (https://keybase.io/rokob) on keybase.
  • I have a public key whose fingerprint is 3F33 4708 A2B3 0CEE 5423 5AA4 B73B C45A A1DF 9D79

To claim this, I am signing this object:

module Jekyll
class Commit < Liquid::Tag
MATCHER = /\A(\S+)\Z/
def render(context)
markup = @markup.strip
page_file = "#{context.registers[:site].source}"
file_path = "#{context.environments.first["page"]["path"]}"
page_file += "/#{file_path}"
init(_Transport, _Req, _Opts) ->
{upgrade, protocol, cowboy_rest}.
rest_init(Req, _Opts) ->
{ok, Req, #state{}}.
allowed_methods(Req, State=#state{}) ->
{[<<"POST">>], Req, State}.
content_types_accepted(Req, State=#state{}) ->