Skip to content

Instantly share code, notes, and snippets.

View 4ndrew's full-sized avatar

Andrew Porokhin 4ndrew

  • Saint-Petersburg, Russia
View GitHub Profile
@ericacm
ericacm / MessageSequence.scala
Last active August 22, 2017 16:49
Implements the Message Sequence pattern from EIP (http://www.eaipatterns.com/MessageSequence.html)
package akka.contrib.pattern
import akka.actor.{Cancellable, ActorLogging, ActorRef, Actor}
import java.util
import akka.serialization.SerializationExtension
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import scala.util.{Try, Failure, Success}
import scala.language.existentials
import java.util.UUID
@ysb33r
ysb33r / RelativePath.groovy
Last active November 4, 2022 14:18
The Groovy way to obtain a relative path given two paths.
def root= new File('/usr/share')
def full= new File('/usr/share/docs/rpm-4.4')
// Print the relative path of 'full' in relation to 'root'
// Notice that the full path is passed as a parameter to the root.
def relPath= new File( root.toURI().relativize( full.toURI() ).toString() )
@yuanying
yuanying / sync-garmin-connect-to-runkeeper.rb
Created May 7, 2012 07:33
Syncronize from Garmin Connect activity to Runkeeper
#!/usr/bin/env ruby -wKU
# Syncronize from Garmin Connect to Runkeeper
require 'rubygems'
require 'runkeeper'
require 'rss/1.0'
require 'rss/2.0'
require 'rss/dublincore'
require 'open-uri'
require 'uri'
require 'cgi'
@mathiasbynens
mathiasbynens / unsafeWindow.user.js
Created August 13, 2011 13:21
`unsafeWindow` polyfill (for use in user scripts)
// ==UserScript==
// @name Emulate `unsafeWindow` in browsers that don’t support it.
// ==/UserScript==
// http://mths.be/unsafewindow
window.unsafeWindow || (
unsafeWindow = (function() {
var el = document.createElement('p');
el.setAttribute('onclick', 'return window;');
return el.onclick();
@karmi
karmi / .gitignore
Created December 1, 2010 10:06
Simple ping:pong WebSockets server and client in Ruby (em-http and em-websocket
Gemfile.lock