This file contains 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
set defsearch=yubnub | |
map <M-w> <Esc>:q<CR> | |
map <M-t> <Esc>:to<CR> | |
map <M-]> <Esc>:tn<CR> | |
map <M-[> <Esc>:tp<CR> | |
command newpad :to http://typewith.me/ep/pad/newpad | |
"map gd gT | |
map gj gt | |
map gk gT | |
map gmj <Esc>:tabmove! +1<CR> |
This file contains 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
/* By dylan (http://www.androidsnippets.org/users/dylan/index.html) | |
* Considering forking and updating VuDroid (http://code.google.com/p/vudroid/) to add in full screen PDF viewing. | |
*/ | |
public class FullScreen extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains 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
#!/bin/bash | |
# Check whether the external monitor is connected | |
xrandr | grep VGA | grep " connected " | |
# 0 is returned on success | |
if [ $? -eq 0 ]; then | |
gconftool -t string -s /desktop/gnome/background/picture_filename /path/to/wallpaper.png | |
else | |
gconftool -t string -s /desktop/gnome/background/picture_filename /path/to/wallpaper_small.png |
This file contains 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
from django.conf import settings | |
from django.utils.translation import string_concat, ugettext_lazy | |
from django.utils.html import strip_tags | |
from haystack import indexes, site | |
from cms.models.managers import PageManager | |
from cms.models.pagemodel import Page | |
from cms.models.pluginmodel import CMSPlugin |
This file contains 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
sudo apt-get install --reinstall libgl1-mesa-dev mesa-common-dev libgl1-mesa-dri-dev libglu1-mesa-dev freeglut-dev |
This file contains 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 sbt._ | |
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) { | |
val liftVersion = "2.2" | |
// uncomment the following if you want to use the snapshot repo | |
// val scalatoolsSnapshot = ScalaToolsSnapshots | |
// Adding Metabroadcast's Maven repository | |
val mavenMetabroadcast = "Metabroadcast Maven Repository" at "http://mvn.metabroadcast.com/all" |
This file contains 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
#include <string.h> | |
#include <stdio.h> | |
#include "handler.h" | |
void handle_request(int sockfd, const char *request) | |
{ | |
char *res = "HTTP 200 OK\r\n\r\n"; | |
char file_buf[1024]; | |
char url[1024]; |
This file contains 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
A few more tweaks & I dropped off a wee logo option here: http://dl.dropbox.com/u/6744016/logo_sm.png | |
body { | |
font-family: "Amaranth", arial, serif; | |
text-shadow: 0px 1px -1px white; | |
} | |
.button { | |
clear: both; | |
background: #39C629; |
This file contains 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
For what it's worth, my experience learning Scala's type system was: | |
- plain old (nominal) types: easy, same as Java | |
- type parameterization: also easy, same as Java, but with square brackets instead of angle brackets. I felt square brackets looked a lot nicer, and probably was therefore easier to read, too. | |
- function types: functions in Scala have nominal types like anything else, with a type parameter for the result type and one each for the parameter types. But there's also a shorthand syntax. Instead of Function1[String, Int], for example, you can say String => Int. The latter is actually easier to read, but when combined with an assignment such as "val a: String => Int = something I find it can sometimes be non-obvious at first glance how to parse it. | |
- traits: traits were quite easy for me to understand and use. They are exactly like classes except they can't (currently) take constructor parameters and the meaning of super is different inside them. Mixing in multiple traits is straightforward, as i |
This file contains 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 scala.util.Random | |
class RandomTraversableOnce[A](seq:TraversableOnce[A]){ | |
def choice = seq.toList (new Random nextInt seq.size) | |
} | |
implicit def toRandomTraversableOnce[A](seq:TraversableOnce[A]) = new RandomTraversableOnce(seq) |
OlderNewer