Skip to content

Instantly share code, notes, and snippets.

View salomvary's full-sized avatar

Márton Salomváry salomvary

View GitHub Profile
ngrep -d tap0 -W byline port 80
@salomvary
salomvary / gist:aa16564410e8d1fad7e4
Created November 12, 2014 09:18
Scala type ascription
scala> class Foo
defined class Foo
scala> class Bar extends Foo
defined class Bar
scala> new Foo
res6: Foo = Foo@3ace5360
scala> new Bar
@salomvary
salomvary / alphabet.markdown
Last active August 29, 2015 14:05
Bulgarian
Name Description
Help Display the help window.
Close Closes a window
Letter Pronounciation
А а А а a in father
Б б Б б b in bat
В в В в v in van
@salomvary
salomvary / apply.bind.js
Last active August 29, 2015 13:57
Finally found a reason to use Function.prototype.apply.bind
test(function() {
[
['foo', 'bar', 'baz'],
['fuz', 'barz', 'bazz'],
['fux', 'bax', 'bazx']
].forEach(Function.apply.bind(function(input1, input2, expectedOutput) {
assertEquals(subject(input1, input2), expectedOutput)
}, this))
})
// Yes, I know there are other (less cryptic) ways to achieve this :)
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import scala.collection.JavaConversions._
val mapper = new ObjectMapper()
mapper.registerModule(DefaultScalaModule)
mapper.configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, true)
mapper.readValue("""{"bar":{"title":"hello"}}""", classOf[Map[String, Any]])
require 'active_support'
require 'json'
puts(
JSON.pretty_generate(
ActiveSupport::TimeZone.all.map do |tz|
{
:id => tz.tzinfo.identifier,
:name => tz.name,
:utc_offset => tz.utc_offset
@salomvary
salomvary / ngrep.sh
Created November 6, 2012 08:56
ngrep
sudo ngrep -W byline -d lo0 port 3000
@salomvary
salomvary / applestore.scala
Created November 29, 2011 21:46
check iPhone availability with Selenium ;)
import org.openqa.selenium._
import org.openqa.selenium.support.ui._
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.openqa.selenium.remote.DesiredCapabilities
import scala.collection.JavaConversions._
import scala.actors.Actor._
object Available {
@salomvary
salomvary / html5.html
Created November 9, 2011 11:32
minimal html5 boilerplate
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title></title>
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
@salomvary
salomvary / app.build.js
Created October 18, 2011 10:36
requirejs test
({
appDir: '.',
baseUrl: './',
dir: '../build/',
optimize: 'none',
modules: [
{
name: 'one',
excludeShallow: ['four', 'five']
},