Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Liip\AcmeBundle\Filter;
use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\DoctrineORMAdminBundle\Filter\StringFilter;
class CaseInsensitiveStringFilter extends StringFilter
{
<!DOCTYPE html>
<meta charset="utf-8">
<h1>Hello, world!</h1>
#!/usr/bin/perl
# configure here:
# first top left (north west)
my $startlon = 13.40991;
my $startlat = 52.48905;
# then bottom right (south east)
my $endlon = 13.42209;
my $endlat = 52.47982;
#zoom level:
@eikes
eikes / .vimrc
Created September 21, 2010 10:03
.vimrc
set nocompatible " disable vi compatibility mode
set nowrap " don't wrap lines
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set showmode
@eikes
eikes / Switch_map_provider.js
Created October 22, 2010 16:41
Switch google maps to openstreetmap and vice versa
javascript:(function(){
if (document.location.href.match(/google/)) {
var link = document.getElementById("link").getAttribute("href");
var llzrx = /ll=(\d*\.\d*),(\d*\.\d*).*&z=(\d+)/;
var match = llzrx.exec(link);
var lat = match[1];
var lon = match[2];
var zoom = match[3];
window.open("http://www.openstreetmap.org/?lat="+lat+"&lon="+lon+"&zoom="+zoom);
}
#!/usr/bin/python
import urllib, urllib2
from BeautifulSoup import BeautifulSoup
def __main__():
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
urllib2.install_opener(opener)
@eikes
eikes / hnpolls.js
Created October 23, 2011 20:18
Hacker News Polls Visualisation JavaScript Bookmarklet
javascript:(function(){
var s = document.createElement("script");
s.setAttribute("src", "http://code.jquery.com/jquery.js");
document.body.appendChild(s);
s.addEventListener("load", function() {
var $ = jQuery;
var max = 0;
var table = "table tr:eq(3) table:eq(1) ";
$(table).width("100%");
$(table + "tr td:eq(0)").width("15px");
@eikes
eikes / date.format.js
Created February 15, 2012 13:34
Copy of amazing date format js script by Steven Levithan: http://blog.stevenlevithan.com/archives/date-time-format
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
String.prototype.toUnicode = function (){
function pad(t) {
return t.length == 4 ? t : pad("0" + t);
}
var r="";
for (var i = 0; i < this.length; i++) {
r += "\\u" + pad(this.charCodeAt(i).toString(16));
}
return r;
}