This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlencode() { | |
# urlencode <string> | |
old_lc_collate=$LC_COLLATE | |
LC_COLLATE=C | |
local length="${#1}" | |
for (( i = 0; i < length; i++ )); do | |
local c="${1:$i:1}" | |
case $c in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.irc | |
import org.jibble.pircbot.PircBot | |
import dispatch._ | |
import Http._ | |
import net.liftweb.json._ | |
import net.liftweb.json.JsonDSL._ | |
import net.liftweb.json.Printer.{compact} | |
import java.io.{PrintStream, ByteArrayOutputStream} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
'''A script to calculate adler32 checksum of given files''' | |
BLOCKSIZE=256*1024*1024 | |
import sys | |
from zlib import adler32 | |
for fname in sys.argv[1:]: | |
asum = 1 | |
with open(fname,"rb") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz._ | |
/** | |
* Provides type aliases and utilities for working with state disjunctions. | |
* | |
* A state disjunction is a function `S => F[(S, L \/ R)]` wrapped in the StateT and EitherT monad | |
* transformers. | |
* | |
* See `StateDisjunctionT` and `StateDisjunction` for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.{Try, Success, Failure} | |
def f(s: String): Try[Int] = Try { s.toInt } | |
def g(i: Int): Try[Int] = Try { i * 2 } | |
def unit[T](v: T): Try[T] = Success(v) | |
//val v = "1" | |
val v = "bad" | |
val m = Success(v) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import concurrent.{ExecutionContext, Future => SFuture, Promise} | |
import util.Try | |
import _root_.scalaz.\/ | |
import _root_.scalaz.concurrent.{Task => ZTask} | |
object Task { | |
def fromScala[A] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FYI: some comments below refer to old version of this gist: https://gist.github.com/pchiusano/7894696/12201b92db57dff8ed6689fc55c15c3f1a136f86 | |
package scalaz.stream | |
import scalaz.\/ | |
import scalaz.concurrent.Task | |
object retries { | |
def dropWhileUnlessAtEnd[I](f: I => Boolean): Process1[I,I] = { | |
def go(prev: Option[I]): Process1[I,I] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package argonaut.example | |
import argonaut._, Argonaut._ | |
import scalaz._, Scalaz._ | |
object UnionExample extends { | |
sealed trait Thing | |
final case class One(n: String, i: Int) extends Thing | |
final case class Two(n: String) extends Thing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
minifycss = require('gulp-minify-css'), | |
jshint = require('gulp-jshint'), | |
uglify = require('gulp-uglify'), | |
rename = require('gulp-rename'), | |
clean = require('gulp-clean'), | |
concat = require('gulp-concat'), | |
notify = require('gulp-notify'), |
OlderNewer