Skip to content

Instantly share code, notes, and snippets.

View whysoserious's full-sized avatar
💭
Making things work

Jan Ziniewicz whysoserious

💭
Making things work
View GitHub Profile
@whysoserious
whysoserious / 0_reuse_code.js
Created October 1, 2013 13:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
object ApiAsyncDispatcher extends RestCommons with RestHelper {
serve {
case "api" :: "async" :: "all" :: Nil Get req => {
User.currentUser match {
case Full(user) => async {
reply => {
AsyncRestListener ! RequestUpdate(RequestId(user, GroupPost, now), reply)
}
}
case _ => async {
import net.liftweb.common._
import net.liftweb.http.LiftRules._
import net.liftweb.http.rest.RestHelper
import net.liftweb.http.{S, JsonResponse, LiftResponse, Req}
import net.liftweb.json.JsonDSL._
import scala.concurrent.duration.Duration
object RateLimit {
@whysoserious
whysoserious / SkipSpec.scala
Created February 17, 2014 10:13
Specs2 use cases
package org.jz.s2ue
import org.specs2.mutable.Specification
class SkipSpec extends Specification {
skipAllUnless(isServerStarted && isDbAvailable)
"This test should not start" >> {
ok
(require 'jabber)
(setq jabber-account-list
'(("pan@gmail.com"
(:network-server . "talk.google.com")
(:connection-type . ssl)
(:port . 5223)
(:password . "xxxxxxxxxxxxxxxxcipa"))))
(setq
++++++++[>+>++>+++>++++>+++++>++++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++>+++++++++++++>++++++++++++++>+++++++++++++++>++++++++++++++++<<<<<<<<<<<<<<<<-]>>>>>>>>+++.---<<<<<<<<>>>>>>>>>>>>>.<<<<<<<<<<<<<>>>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<<<>>>>>>>>>>>>>++.--<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>>+++.---<<<<<<<<<<<<>>>>>>>>>>>>>+.-<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>>>>>-.+<<<<<<<<<<<<<<<>>>>.<<<<>>>>>>>>>>>>>----.++++<<<<<<<<<<<<<>>>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<<<>>>>>>>>>>>>>>.<<<<<<<<<<<<<<>>>>>>>>>>>>>---.+++<<<<<<<<<<<<<.
#!/bin/bash
#########################################################################################################################
# MIT License
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@whysoserious
whysoserious / Build.scala
Last active December 19, 2018 16:12
Running SBT tasks before and after tests
object MyProject {
val projectSettings = inConfig(Test)(
testOptions += Tests.Setup { _ =>
// add your initialization code here eg.:
(runMain in Compile in OtherSubproject).toTask(" b.c.d.CustomMainFunction args").value
}
testOptions += Tests.Cleanup { _ =>
// add your clean up code here
}
@whysoserious
whysoserious / .sbtconfig
Last active August 29, 2015 14:07
.sbtconfig
SBT_OPTS=’ \
-Xmx4G \
-XX:+UseConcMarkSweepGC \
-XX:+CMSClassUnloadingEnabled \
-Xss2M -Duser.timezone=GMT \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
-J-Xmx4G
-J-XX:+UseConcMarkSweepGC
-J-XX:+CMSClassUnloadingEnabled
-J-Xss2M -Duser.timezone=GMT
-jvm-debug 5008