Skip to content

Instantly share code, notes, and snippets.

View negator's full-sized avatar

Naveen Gattu negator

View GitHub Profile
object log {
class LineOfCode() {
val loc = {
val list = Thread.currentThread.getStackTrace.toList
list match {
case (_ :: _ :: _ :: loc :: loc2 :: _) => s"${loc2.getFileName}:${loc2.getLineNumber}->${loc.getFileName}:${loc.getLineNumber}"
case _ => ""
}
}
}
@negator
negator / shapeless_2-1-0-json.scala
Last active June 27, 2016 13:05
shapeless_2.1.0-json.scala
/**
The Play (2.3) json combinator library is arguably the best in the scala world. However it doesnt
work with case classes with greater than 22 fields.
The following gist leverages the shapeless 'Automatic Typeclass Derivation' facility to work around this
limitation. Simply stick it in a common location in your code base, and use like so:
Note: ** Requires Play 2.3 and shapeless 2.1.0
import SWrites._
import SReads._
@negator
negator / shapeless-xml.scala
Last active April 26, 2017 04:13
Easy XML typeclasses with Shapeless and Scalaz
/** Domain mapped XML doesnt have to be a boilerplate filled annotational mess. Using shapeless automatic
* typeclass derivation and a little scalaz magic, it becomes painless. Requires shapeless-2.1.0 and scala >2.10
*
*
* import scalaz._
* import scalaz.std._
* import anyVal._
* import list._
* import scala.xml._
*
@negator
negator / designer.html
Created February 28, 2015 02:29
designer
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@negator
negator / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../core-ajax/core-ajax.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<polymer-element name="my-element">
<template>
@negator
negator / blum.py
Created January 29, 2016 20:26
blum secure password algorithm
import string
import re
alpha = raw_input('alpha: ')
seq = raw_input('seq: ')
name = raw_input('text: ')
seq = map(int, list(seq.replace(" ","")))
f = dict(zip(list(string.ascii_lowercase), map(int, list(alpha.replace(" ","")))))