Skip to content

Instantly share code, notes, and snippets.

View flashingpumpkin's full-sized avatar
🏠
Working from home

Alen Mujezinovic flashingpumpkin

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python
"""
Makes JSON files out of CSV files.
"""
import argparse
import csv
import json
parser = argparse.ArgumentParser(description = "Turns a CSV file into JSON")

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@flashingpumpkin
flashingpumpkin / gist:5300098
Created April 3, 2013 10:32
Appcelerator stopping PyDev support
I'm reaching out for you today to ask for your help to keep PyDev properly supported, as well as improving some aspects of Eclipse itself (especially for those that like to work with a Dark theme).
A campaign was created at Indiegogo (http://igg.me/at/liclipse) for this purpose, and I'd really appreciate if you can take some time to take a look at it and share it (and if possible contribute) if you feel that those are worthy goals.
Without your help, it's possible that PyDev may become unsupported!
Thanks,
Fabio
export PYTHONSTARTUP=/etc/profile.d/pythonrc.py
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@flashingpumpkin
flashingpumpkin / ffmpeg.sh
Last active February 22, 2021 16:00
Save the following file in your project as `bin/post_compile` and after slug compilation it will be downloaded and a binary placed in a `vendor/ffmpeg` folder in your project root. Invoke FFMPEG as `/app/vendor/ffmpeg/ffmpeg -h`
#!/bin/bash
current=`pwd`
filename=ffmpeg.static.64bit.2013-08-15.tar.gz
url=http://ffmpeg.gusari.org/static/64bit/$filename
source $BIN_DIR/utils
puts-step "Installing FFMPEG"
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the
@flashingpumpkin
flashingpumpkin / .Xmodmap
Created September 15, 2013 10:43
Swapping Option (Alt) and Command (Meta/Super) keys on an Apple keyboard for use in Linux / Emacs
clear Mod1
clear Mod2
clear Mod3
clear Mod4
clear Mod5
keycode 133 = Alt_L Meta_L
keycode 134 = ISO_Level3_Shift
keycode 108 = Super_R
@flashingpumpkin
flashingpumpkin / pins.geojson
Created September 17, 2013 11:18
GeoJSON format for importing content into Pin Drop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from pretend import stub
class Comparison(object):
def __or__(self, other):
return Or(self, other)
def __and__(self, other):
return And(self, other)
def __call__(self):