This file contains hidden or 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
public class Slugify { | |
public static String slugify(String input) throws UnsupportedEncodingException { | |
if (input == null || input.length() == 0) return ""; | |
String toReturn = normalize(input); | |
toReturn = toReturn.replace(" ", "-"); | |
toReturn = toReturn.toLowerCase(); | |
toReturn = URLEncoder.encode(toReturn, "UTF-8"); | |
return toReturn; | |
} |
This file contains hidden or 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
object Availability extends Enumeration { | |
val Free = Value("free") | |
val Busy = Value("busy") | |
val OOF = Value("oof") | |
val options = values.map(a => (a.toString -> a.toString.capitalize))(collection.breakOut) | |
} | |
case class User( | |
@Key("_id") id: ObjectId = new ObjectId, |
This file contains hidden or 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
# | |
# Install: | |
# install https://github.com/github/gollum | |
# in /srv/wiki do a git init | |
# add this script to /etc/init/gollum.conf | |
# | |
# Usage: | |
# start/stop/restart gollum | |
# |
This file contains hidden or 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
<?php | |
/** | |
Truncate Html string without stripping tags | |
register in Resources/config/services.yml with: | |
services: | |
truncatehtml.twig.extension: | |
class: Radley\TwigExtensionBundle\Extension\TruncateHtmlExtension | |
tags: | |
- { name: twig.extension } |
This file contains hidden or 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
server { | |
listen 80; | |
server_name localhost; | |
root /home/website/web; | |
rewrite ^/app\.php/?(.*)$ /$1 permanent; | |
try_files $uri @rewriteapp; | |
location @rewriteapp { |
This file contains hidden or 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 org.specs2.mutable._ | |
import org.specs2.time.NoTimeConversions | |
import akka.actor._ | |
import akka.testkit._ | |
import akka.util.duration._ | |
/* A tiny class that can be used as a Specs2 'context'. */ | |
abstract class AkkaTestkitSpecs2Support extends TestKit(ActorSystem()) | |
with After |
This file contains hidden or 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
<!DOCTYPE html> | |
<html version="HTML+RDFa 1.1" lang="en"> |
This file contains hidden or 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 utils; | |
import com.avaje.ebean.Ebean; | |
import org.yaml.snakeyaml.constructor.AbstractConstruct; | |
import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; | |
import org.yaml.snakeyaml.nodes.Node; | |
import org.yaml.snakeyaml.nodes.ScalarNode; | |
import org.yaml.snakeyaml.nodes.Tag; | |
import java.util.regex.Matcher; |
This file contains hidden or 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 models.sgcore; | |
import com.avaje.ebean.event.BeanPersistAdapter; | |
import com.avaje.ebean.event.BeanPersistRequest; | |
import javax.annotation.PreDestroy; | |
import javax.persistence.*; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.HashMap; |
This file contains hidden or 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
/* | |
http://thecodeplayer.com/walkthrough/single-element-pure-css3-double-fold-ribbon | |
*/ | |
/*Basic reset*/ | |
* {margin: 0; padding: 0;} | |
html, body {height: 100%;} | |
body { |