Skip to content

Instantly share code, notes, and snippets.

View Tolsi's full-sized avatar
⌨️
I am jumping on the keyboard

Sergey Tolmachev Tolsi

⌨️
I am jumping on the keyboard
View GitHub Profile
@grimen
grimen / jquery-iframe_3rdparty_cookie
Created March 18, 2013 19:17
Old hack for supporting 3rd party cookies in Safari using an iframe.
@Beeblerox
Beeblerox / dumpBits example
Created July 8, 2013 12:17
This is an example of how you can reduce memory usage for Tilesheet class in openfl with dumpBits() method. But you also listen for stage resize event and recreate tilesheet after context loss.
import flash.Lib;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.display.BitmapData;
import openfl.Assets;
import openfl.display.Tilesheet;
import flash.display.Graphics;
import flash.events.Event;
class Particle
@gabrielhpugliese
gabrielhpugliese / coderstv-router.js
Created November 8, 2013 14:21
Iron-router for http://coderstv.com with tracking - something may be missing because it's coderstv internals
Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});
@wsargent
wsargent / gist:5860224
Created June 25, 2013 16:58
Using ning async http client
import play.api.libs.ws.Response
import scala.concurrent.{Future, Promise}
import com.ning.http.client._
import com.ning.http.client.{Response => AHCResponse}
import com.ning.http.client.AsyncCompletionHandler
val url = "http://google.com"
val config = new AsyncHttpClientConfig.Builder()
@gclaramunt
gclaramunt / Circularbuffer.scala
Created November 23, 2011 17:33
circular buffer
package my.collections
class CirculrBufferIterator[T](buffer:Array[T], start:Int) extends Iterator[T]{
var idx=0
override def hasNext = idx<buffer.size
override def next()={
val i=idx
idx=idx+1
buffer(i)
}
@laszlomiklosik
laszlomiklosik / Install flash player debug version on Ubuntu 64 bit
Created June 2, 2012 08:20
Install Flash Player debug version in Ubuntu 12.04 64 bit
# no 64 bit version of the flash debug player is available, thus we will use the 32 bit version and use nspluginwrapper to make it work
sudo killall -9 firefox
sudo apt-get remove -y --purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo apt-get install ia32-libs nspluginwrapper libcurl3 libnss3-1d libnspr4-0d
cd ~
@remeniuk
remeniuk / GameSpec.scala
Created April 10, 2011 10:58
Type-safe Tic-Tac-Toe
package com.vasilrem.ttt
import org.specs._
class GameSpecs extends Specification{
implicit def toOption[A, B](either: Either[A, B]): Option[B] =
either.right.toOption
"Play a winning game" in {
@thedmitriyk
thedmitriyk / FlickrBase58Coder.scala
Last active November 3, 2016 10:44
Flickr Base58 encoder and decoder written in Scala.
object FlickrBase58Coder {
val alpha = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
val base = alpha.length
def apply(encodedInput: String) = decode(encodedInput)
def apply(decodedInput: Long) = encode(decodedInput)
def encode(input: String): String = encode(input.toLong)
def encode(input: Long) = {
def enc(in: Long, acc: String): String = if (in < 1) acc else enc(in / base, alpha((in % base).toInt) + acc)
@mandubian
mandubian / gist:0fd090c0f75a46346f5e7898eeac9e28
Last active September 15, 2017 15:11
Improving compile-time for structure based on implicits resolutions
@viktorklang
viktorklang / NettyChannelFutureToScalaFuture.scala
Created December 19, 2012 16:57
Shows how you can use the Promise API of SIP-14 to bridge between Netty ChannelFutures and scala.concurrent.Future
object NettyFutureBridge {
import scala.concurrent.{ Promise, Future }
import scala.util.Try
import java.util.concurrent.CancellationException
import org.jboss.netty.channel.{ Channel, ChannelFuture, ChannelFutureListener }
def apply(nettyFuture: ChannelFuture): Future[Channel] = {
val p = Promise[Channel]()
nettyFuture.addListener(new ChannelFutureListener {
def operationComplete(future: ChannelFuture): Unit = p complete Try(