Skip to content

Instantly share code, notes, and snippets.

View dmfrank's full-sized avatar
🐢
I may be slow to respond.

Dmitry Frank dmfrank

🐢
I may be slow to respond.
View GitHub Profile
@dmfrank
dmfrank / PlayBrowserSpec.scala
Created November 8, 2016 02:15 — forked from sebnozzi/PlayBrowserSpec.scala
How to integrate ScalaTest (FlatSpec) with Play
import org.scalatest.BeforeAndAfterAll
import org.openqa.selenium.WebDriver
import org.openqa.selenium.htmlunit.HtmlUnitDriver
import org.scalatest.FlatSpec
import play.api.test.TestServer
import org.scalatest.Matchers
import play.api.test.Helpers
import org.scalatest.selenium.WebBrowser
import play.api.test.FakeApplication
@dmfrank
dmfrank / FunctionalComposition.scala
Created November 8, 2016 02:15 — forked from sam/FunctionalComposition.scala
Simple example of a Play Framework / ScalaTest spec using functional composition to keep the building of two similar Requests (only difference is the Request-Method) DRY.
"Delete" taggedAs(tag.RolesTag) in {
val request = (FakeRequest(_:String, "/admin/roles/role-bob")) andThen
withAdminCredentials andThen
(route(_:FakeRequest[AnyContentAsEmpty.type]))
for { result <- request(DELETE) } {
status(result) must equal(SEE_OTHER)
flash(result).data must contain key("deleted")
}
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@dmfrank
dmfrank / bomp.sh
Created February 23, 2016 09:42 — forked from peter-leonov/bomb.sh
docker fork bomb
docker run ruby ruby -e 'loop { fork { fork { sleep 0.1 } } }'
@dmfrank
dmfrank / client.go
Created February 23, 2016 07:32 — forked from jpillora/client.go
Go Yamux Example
package main
import (
"fmt"
"log"
"net"
"time"
"github.com/hashicorp/yamux"
)
@dmfrank
dmfrank / rebuild_goproject.sh
Created February 14, 2016 18:40 — forked from carbocation/gist:5278173
On OS X, use fswatch to automatically recompile your golang project whenever you change a file in the directory.
#!/bin/bash
# This script keeps watch on the current project and compiles it continuously as you change files.
# If there are multiple projects with the same final directory name (e.g., /proj/rad and /lib/monster/rad),
# this will kill any other similarly-named running projects' binaries, potentially leading to havoc.
# To run, install fswatch, drop this file into your project directory, make it executable, and run:
# /usr/local/bin/fswatch ./ ./continuous-compile.sh
echo "Re-compiling"
@dmfrank
dmfrank / parser.go
Created February 10, 2016 20:41 — forked from eahydra/parser.go
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"net/http"
)
type RssLayout struct {
@dmfrank
dmfrank / pricingResCookie.parts.js
Created January 29, 2016 13:30 — forked from mbj/pricingResCookie.parts.js
Why does sixt.de hide they are stealing my history?
// http://www.sixt.de/static/oi/js/pricingResCookie.js | 2012-11-08 21:56 UTC+2
// Loaded when visiting http://www.sixt.de Line 1178.
// Lines: 821-853 with decoded base64 in comments.
// checkHistory() does CSS :visited based history stealing.
// The privacy policy does not reflect they are hitting my privacy with this. Somewhere deeper in the code they are
// checking for: something-even-more-private.com? I dislike such stuff, how far do they want to go?
// German privacy policy under: http://www.sixt.de/informationen/datenschutz/
// I'm not a so happy customer anymore.
var ep = [