Skip to content

Instantly share code, notes, and snippets.

View bestform's full-sized avatar

Matthias Derer bestform

View GitHub Profile
@bestform
bestform / keys
Created May 11, 2012 06:52
fluxbox keys
# click on the desktop to get menus
OnDesktop Mouse1 :HideMenus
OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu
# scroll on the desktop to change workspaces
OnDesktop Mouse4 :PrevWorkspace
OnDesktop Mouse5 :NextWorkspace
# scroll on the toolbar to change current window
@bestform
bestform / gist:6129263
Created August 1, 2013 07:44
traceroute to getcomposer.org
traceroute to getcomposer.org (87.98.253.108), 30 hops max, 60 byte packets
1 router.intra (192.168.1.254) 1.468 ms 13.655 ms 13.664 ms
2 217.0.117.227 (217.0.117.227) 19.031 ms 19.044 ms 19.039 ms
3 217.237.155.74 (217.237.155.74) 33.895 ms 33.911 ms 33.905 ms
4 f-ed3-i.F.DE.NET.DTAG.DE (62.154.14.194) 33.900 ms 33.896 ms 33.892 ms
5 * * *
6 fra-5-6k.fr.eu (94.23.122.218) 35.093 ms * *
7 * * *
8 * * *
9 * * *
@bestform
bestform / gist:9759566
Last active August 29, 2015 13:57
Strange fail after casting float to int
<?php
class CastToIntTest extends PHPUnit_Framework_TestCase
{
public function testCastToInt()
{
$a = 4.89;
$b = $a * 100;
$c = (int) $b;
@bestform
bestform / gist:9760286
Created March 25, 2014 11:57
Same thing in python
>>> a = 4.89
>>> a
4.89
>>> b = a * 100
>>> b
488.99999999999994
>>> int(b)
488
@bestform
bestform / gist:9760513
Created March 25, 2014 12:08
it doesn't happen in c
#include<stdio.h>
int main() {
double a = 4.89;
double b = a * 100;
printf("%f", b);
return 0;
}
@bestform
bestform / gist:9760708
Created March 25, 2014 12:16
And in java...
public class Foureightnine {
public static void main(String[] args)
{
double a = 4.89;
double b = a * 100;
System.out.print(b);
}
}
@bestform
bestform / gist:9760737
Created March 25, 2014 12:18
And in javascript
a = 4.89;
// 4.89
b = a * 100;
// 488.99999999999994
@bestform
bestform / gist:10243160
Last active August 29, 2015 13:58
login feature
Given I am on "/"
And I fill in "slogin" with "foo"
And I fill in "password" with "bar"
And I press "loginbutton"
<?php
$rootNode
->children()
->scalarNode('path')
->defaultValue('%kernel.cache_dir%/gitprojects')
->validate()->ifTrue(function($value){
return !file_exists($value);
})->thenInvalid('Path must exist')
->end()
INFO: Pausing Coyote HTTP/1.1 on http-8080
Aug 05, 2014 5:23:22 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Aug 05, 2014 5:23:24 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/jenkins] created a ThreadLocal with key of type [com.sun.jna.Native$3] (value [com.sun.jna.Native$3@71dd3ae]) and a value of type [java.lang.Integer] (value [2]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 05, 2014 5:23:24 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/jenkins] created a ThreadLocal with key of type [com.google.inject.internal.InjectorImpl$1] (value [com.google.inject.internal.InjectorImpl$1@37344828]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@496d5668]) but failed to remove it when the web application was s
topped. This is very likely to create a memory leak.
Aug 05, 2014 5: