Skip to content

Instantly share code, notes, and snippets.

@rokob
rokob / gist:2466176
Created April 22, 2012 18:56
Getting live updates and deletes in ChicagoBoss Tutorial
% src/view/greeting/live.html
<html><head>
<title>Fresh hot greetings!</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script>
function listen_for_events(timestamp) {
$.ajax("/greeting/pull/"+timestamp, { success:
function(data, code, xhr) {
for (var i=0; i<data.greetings.length; i++) {
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
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{}) ->
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}"
@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 A
class B
def shit(x)
puts "I AM THE ORIGINAL #{x}"
x + 1
end
alias_method :oops, :shit
end
end
@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) {
@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;
[
{"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",
def main():
try:
other()
except Exception as e:
pass
def other():
raise Exception('woof')