Skip to content

Instantly share code, notes, and snippets.

@lauris
lauris / .vimrc
Created January 1, 2012 22:52
vimrc
set fileencodings=utf-8
set title
set encoding=utf-8
set showcmd
set showmode
set cmdheight=1
set autoread
set cursorline
<?php
namespace Foobar\NewsBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Foobar\NewsBundle\Entity\Item;
use Foobar\NewsBundle\Entity\Subscriber;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\Email;
<?php
namespace Foobar\NewsBundle\Listener;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Foobar\NewsBundle\Entity\Item;
use Foobar\NewsBundle\Entity\Subscriber;
/**
@lauris
lauris / latvian-ip-address-blocks
Created May 4, 2013 09:36
IP address blocks assigned to Latvia
159.148.0.0/16
85.254.0.0/17
85.254.128.0/18
79.135.128.0/19
62.84.0.0/19
194.8.42.0/24
195.244.128.0/20
85.234.160.0/19
84.38.128.0/20
91.188.32.0/19
@lauris
lauris / Balance.scala
Created September 18, 2013 07:31
A recursive function which verifies the balancing of parentheses in a string, which we represent as a List[Char]. Recfun 2013, Week 1.
package recfun
import common._
import scala.annotation.tailrec
object Balance {
def balance(chars: List[Char]): Boolean = {
@tailrec
def loop(chars: List[Char], open: Int): Boolean = {
chars match {
case Nil => open == 0
@lauris
lauris / github-vim.js
Created December 13, 2013 11:44
Github Vim
ace.require("ace/lib/net").loadScript("https://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/keybinding-vim.js", function() {
e = document.getElementById("ace-editor").env.editor;
e.setKeyboardHandler(ace.require("ace/keyboard/vim").handler);
})
alert((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]);
/** Fix navigation bar width */
.global-nav .container { max-width: 910px; }
/** Hide Me & DM menu items */
.global-nav li.profile, .global-nav .dm-nav { display: none; }
/** Remove bottom border from active menu item and just set text color to black instead */
#global-actions > li > a { border-bottom: none; }
#global-actions > li:hover > a, #global-actions>li.active>a { color: black; }
ace.require("ace/lib/net").loadScript("https://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/keybinding-vim.js", function() {
e = $(".file-contents").codeEditor().editor;
e.setKeyboardHandler(ace.require("ace/keyboard/vim").handler);
})
implicit def flipImplicitlyCurried[A,B,C](f: A => B => C) = (b: B) => (a: A) => f(a)(b)