Skip to content

Instantly share code, notes, and snippets.

View jaapz's full-sized avatar

Jaap Broekhuizen jaapz

View GitHub Profile
@jaapz
jaapz / todo.js
Last active August 29, 2015 14:01 — forked from anonymous/todo.js
$(function() {
"use strict";
// Model. Als toggle gecalled word zal done geinvert worden. Ook word de titel aangepast zodat de view opnieuw rendert.
var Todo = Backbone.Model.extend({
defaults: {
title: "Something to remember",
done: false
},
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
@jaapz
jaapz / sorting.py
Last active August 29, 2015 14:11
sorting a list using itemgetter
from operator import itemgetter
mylist = [
["Some", "Data", "30.0", 12.10],
["Foo", "Bar", "29.5", 90.00],
["Fizz", "Buzz", "29", 13.12]
]
# Sorting using a field that already has a nice sortable type (for example, a float).
my_sorted_list_4 = sorted(mylist, key=itemgetter(3))
@jaapz
jaapz / breaks.rs
Last active August 29, 2015 14:12
Why does this happen?
struct Record {
name: String,
message: String,
}
// Let's say `record` is an instance of Record, with strings in name and message.
// This will work correctly:
let message =
@jaapz
jaapz / dmenu-4.5-xft-width-xy.diff
Last active August 29, 2015 14:13
dmenu 4.5 patch containing xft, x and y positioning and window width
diff --git a/config.mk b/config.mk
index 92a5e63..9cff5db 100644
--- a/config.mk
+++ b/config.mk
@@ -12,9 +12,13 @@ X11LIB = /usr/X11R6/lib
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA
+# Xft, comment if you don't want it
+XFTINC = -I/usr/include/freetype2
var req = new Request.JSON({
method: 'get',
url: 'ajax/graphDataRequest.php',
initialDelay: 0,
delay: 60000,
onRequest: function() {
// do stuff
},
onSuccess: function(json) {
// do stuff
<?php
namespace VoetbalMoment\FrontendBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* VoetbalMoment\FrontendBundle\Entity\Pagina
*
* @ORM\Table(name="pagina")
// Find optimal move
private Best chooseMove( int side, int[][] board )
{
int opp; // The other side
int win;
Best reply; // Opponent's best reply
int simpleEval; // Result of an immediate evaluation
int bestRow = 0;
int bestColumn = 0;
int bestReply = 0;
jaapz@supergrover:~/Programmeren/Elementary/scratch/build$ gdb scratch
GNU gdb (Ubuntu/Linaro 7.4-2012.02-0ubuntu2) 7.4-2012.02
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
jaapz@ieniemienie:~/Programmeren/Elementary/gdrive/build$ make
[ 14%] Generating src/GDrive.c, src/GoaAuthorizer.c, src/Widgets/WebView.c, src/Widgets/FileView.c, build/src/Config.c
/home/jaapz/Programmeren/Elementary/gdrive/src/GDrive.vala:165.3-165.21: error: The name `insert_tab' does not exist in the context of `Granite.Widgets.DynamicNotebook'
notebook.insert_tab (new Granite.Widgets.Tab (title, new ThemedIcon (icon_name), scroll_view), -1);
^^^^^^^^^^^^^^^^^^^
/home/jaapz/Programmeren/Elementary/gdrive/src/GoaAuthorizer.vala:75.24-75.27: warning: Argument 1: Cannot pass null to non-null parameter type
soup_uri.set_query (null);
^^^^
/home/jaapz/Programmeren/Elementary/gdrive/src/GoaAuthorizer.vala:76.27-76.30: warning: Argument 1: Cannot pass null to non-null parameter type
soup_uri.set_fragment (null);