Skip to content

Instantly share code, notes, and snippets.

View jtammen's full-sized avatar

Jan Tammen jtammen

View GitHub Profile
@bihe
bihe / init.d play
Created September 25, 2011 18:16
init.d script to launch Play framework under Ubuntu
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
@domdorn
domdorn / playframework
Created October 15, 2011 15:57
Upstart Script for the PlayFramework 1.x
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/playframework
# you can then start/stop it using either initctl or start/stop/restart
# e.g.
# start playframework
# http://dominikdorn.com
description "Description of your app"
author "Dominik Dorn <dominik@studyguru.eu>"
version "1.0"
@innotekservices
innotekservices / jquery.spin.js
Created October 16, 2011 02:39
jQuery Plugin for Spin.js
/*
You can now create a spinner using any of the variants below:
$("#el").spin(); // Produces default Spinner using the text color of #el.
$("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
$("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
$("#el").spin({ ... }); // Produces a Spinner using your custom settings.
$("#el").spin(false); // Kills the spinner.
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@benoit-ponsero
benoit-ponsero / EbeanPersistController.java
Created September 21, 2012 12:13
Play2.1.x Ebean - @PrePersist @PostPersist @PreDestroy @PreUpdate @postupdate @PostLoad
package utils.db;
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.Map;
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@impressiver
impressiver / raven-config.html
Last active February 27, 2024 14:27
Raven.js configuration for logging JavaScript exceptions to Sentry (https://getsentry.com/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Raven.js Config -->
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script>
<script type="text/javascript">
// Ignore list based off: https://gist.github.com/1878283
var ravenOptions = {
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion.
// See: https://github.com/getsentry/raven-js/issues/73
ignoreErrors: [
// Random plugins/extensions
'top.GLOBALS',
@jfsiii
jfsiii / index.html
Last active January 4, 2021 18:11
Full-Screen Layout using Flexbox
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;
@Munter
Munter / example.server.config
Created May 16, 2013 08:42
Nginx example setup for a single page web application with far future expires static content in /static/ and proxying to several backends on any other request that /static or /.
upstream backends {
ip_hash;
server 0.0.0.0:80;
server 0.0.0.0:80;
}
server {
server_name app.falconsocial.com;
@jakemmarsh
jakemmarsh / controllers.js
Last active May 20, 2019 10:15
AngularJS Service with Controller for access to Google API with Javascript Client (and RequireJS)
define(['angular', 'services'], function (angular) {
'use strict';
return angular.module('myApp.controllers', ['myApp.services'])
.controller('IndexCtrl', ['$scope', 'googleService', function ($scope, googleService) {
$scope.login = function () {
googleService.login().then(function (data) {
// do something with returned data
console.log(data.email);