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
@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"
// 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 () {
export PYTHONSTARTUP=/etc/profile.d/pythonrc.py
@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

#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(

#!/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")
834 gs
532 emacs
498 cd
490 git
302 ga
284 ls
231 ack
200 rm
160 gc
156 gp
@flashingpumpkin
flashingpumpkin / .ctags
Created August 2, 2012 15:11
CoffeeScript .ctags file
-R
--exclude=.git
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*class[ \t]+([A-Za-z.@]+)/\1/,class/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]*\:.*(->|=>).*$/\1/,method/
--regex-coffee=/^[ \t]*(@[A-Za-z.]+)[ \t]*\:.*(->|=>).*$/\1/,staticmethod/
--regex-coffee=/^[ \t]*([A-Za-z.]+)[ \t]*=.*(->|=>).*$/\1/,function/
--regex-coffee=/^[ \t]*([A-Z0-9_]+)[ \t]*=.*$/\1/,constant/
@flashingpumpkin
flashingpumpkin / git-compare.py
Created July 5, 2012 12:42
Quick n dirty hack to compare two branches - eg show missing commits.
#!/usr/bin/env python
import sys
import os
def run():
b1 = sys.argv[1]
b2 = sys.argv[2]
checkout = lambda branch: os.popen('git checkout %s' % branch)
#!/usr/bin/env python
import sys
import os
import optparse
parser = optparse.OptionParser()
parser.add_option('-p','--port',help = "Port number locally", default = 8888)
if __name__ == "__main__":