Skip to content

Instantly share code, notes, and snippets.

@antila
antila / debugLog.js
Created January 31, 2013 10:40
Debug log helper. Never add a console.log to your code. This one also runs a stack trace to show where it got called from. Otherwise you'll just see the line in this gist as the source of the log message, and that isn't helpful since you want to see where the log call was made.
var app = {
debug: function(message, level) {
// Default level for logs
if (typeof level === 'undefined' || level === 'log') {
level = 'info';
}
// If we have a console...
if (typeof console === 'object' && typeof console.debug === 'function') {
// ...and the requested log level exists
@antila
antila / gist:5371352
Last active December 16, 2015 03:39
Wordpress woes

The Divine Comedy

“Through me you pass into the city of woe: Through me you pass into eternal pain: Through me among the people lost for aye. Justice the founder of my fabric moved: To rear me was the task of power divine, Supremest wisdom, and primeval love. Before me things create were none, save things

@antila
antila / touch-less.sh
Created November 21, 2013 16:00
Assetic isn't avare of file changes in files @imported in LESS/SASS. This hack touches the main theme file that imports them, to force a recompile. See https://github.com/kriswallsmith/assetic/issues/79
#!/bin/sh
hash inotifywait 2>/dev/null || { echo >&2 "I require package inotify-tools but it's not installed. Try: apt-get install inotify-tools"; exit 1; }
while true;
echo "Waiting for changes in .less-files."
do N=`find src -name "*.less" `;
inotifywait -qe modify $N;
echo "Touching: src/Cos/Bundle/CosBundle/Resources/public/themes/oden/theme.less"
@antila
antila / keybase.md
Created September 22, 2014 21:35
Keybase Proof

Keybase proof

I hereby claim:

  • I am antila on github.
  • I am antila (https://keybase.io/antila) on keybase.
  • I have a public key whose fingerprint is 5E16 4F77 A1C9 92A9 3931 EEC2 EB8B 8761 935F 6073

To claim this, I am signing this object:

@antila
antila / links.txt
Created December 11, 2014 18:31
node-webkit links
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <inttypes.h>
int64_t divide_into_largest_factor(int64_t input) {
int64_t divisor = 2;
if (2 < input) {
while (divisor < (sqrt(input)+1)) {
if (input % divisor == 0) {
@antila
antila / update-public-ssh-keys.sh
Created June 8, 2015 14:16
My new public key
# Nuke my old keys
rm /home/aantila/.ssh/authorized_keys
# Grab new one
gpg2 --recv-keys 0A361939
gpgkey2ssh 700C8678 >> /home/aantila/.ssh/authorized_keys
# ... and add a comment
sed -i.bak s/COMMENT/"anders@antila.se-yubikey"/g /home/aantila/.ssh/authorized_keys
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 6
// How many NeoPixels are attached to the Arduino?
#define NUM_LEDS 60
// How much the light should dim per loop
#define falloff 1
@antila
antila / roll20-max-video-size.js
Last active October 17, 2016 20:08
Makes roll20 video boxes take up all avaliable screen size.
$('#hax').off('.hax').remove();
var $videoSettings = $('<input id="hax" type="range" min="200" max="1000"/>');
$videoSettings.appendTo($('#mysettings .content'));
var inputChange = function() {
var windowSize = $(this).val();
$('.video').css('min-width', windowSize);
$('.video').css('min-height', windowSize * (3/4));
$('#playerzone.largevideo object, #playerzone.largevideo .OT_root, .OT_widget-container').attr('style', 'width: ' + windowSize + 'px !important; height: ' + windowSize * (3/4) + 'px !important;');
$('.playername').css('max-width', '100%');