Skip to content

Instantly share code, notes, and snippets.

@cimm
cimm / localized_ruby.rb
Created November 23, 2012 15:50 — forked from jimeh/__readme.md
Let's not localize programming languages. Please >_<
# Let's not localize programming languages. Please >_<
#
# Feel free to fork and expand and/or add more languages as an example
# to why this would be horrible, and I'll add them here :)
# Ruby in English
if user.is_alive?
# send spam mail
@cimm
cimm / image_width.js
Created February 2, 2015 19:48
Get the image width in client side JavaScript
var file = ... // a File web API interface: https://developer.mozilla.org/en-US/docs/Web/API/File
img = new Image();
img.src = URL.createObjectURL(file);
img.onload = function() {
alert(this.naturalWidth);
};
@cimm
cimm / AuthorDelegate.qml
Created March 27, 2015 09:02
Nested elements in a QML XmlListModel
import QtQuick 2.0
ListView {
property int parentIndex
height: 20
model: MyXmlListModel{
query: "/papers/paper["+parentIndex+"]/authors/author"
}
@cimm
cimm / vpn-warning.sh
Created March 26, 2018 21:19
Intended to run in cron, a little nudge to warn me to turn on my VPN
#!/bin/sh
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
if /sbin/ifconfig tun0; then
echo "VPN is active";
else
DISPLAY=:0 notify-send "VPN is not active"
fi