Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block gudbergur

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gudbergur /
Created May 4, 2012
watchjs - Watch Javascript/CoffeeScript files for changes, concatenate and uglify

watchjs - Watch Javascript/CoffeeScript files for changes, concatenate and uglify

Just a very simple Python script (that depends on Node executables :p) to concatenate JS/Coffeescript files and compress them. I run a Procfile with Foreman that runs this python script on the js/ directory in small projects + stylus on the .styl files. It's similar to some functionality of but where Brunch is not suited I needed a small wrapper to do this for me.


chmod +x

./ <directory> <output filename>

gudbergur / README
Created Apr 30, 2012
Add CSS class to mobile browsers
Simple javascript that adds "mobile" class to body tag when visited by mobile browsers but "desktop" otherwise.
Instructions: Add <script src="<path to>mobilecss.js"></script> before </body>
gudbergur / gist:2366485
Created Apr 12, 2012
Crude Django request object to text
View gist:2366485
def dump_request(request):
text = "*** GET ***<br/>\n"
for k in self.request.GET:
text += k+": "+self.request.GET.getlist(k))+"<br/>\n"
text += "*** POST ***<br/>\n"
for k in self.request.POST:
text += k+": "+self.request.POST.getlist(k))+"<br/>\n"
text += "*** COOKIES ***<br/>\n"
for k in self.request.COOKIES:
text += k+": "+self.request.GET.get(k))+"<br/>\n"
gudbergur / README.markdown
Created Feb 19, 2012
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things
View README.markdown

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
    # source can be a function
    source: (typeahead, query) ->
      # this function receives the typeahead object and the query string
gudbergur / gist:1426081
Created Dec 3, 2011
Very bare plugin for TinyMCE
View gist:1426081
// Requirements: jQuery
// Installation: Add this to your tinyMCE.init, put in your button image and your key and you're good to go
// This is just a very simple button cause Google turned up squat.
setup : function(ed) {
ed.addButton('myembedly', {
title : '',
image : 'BUTTON IMAGE',
onclick : function() {
var url = prompt("Enter URL to embed");
if (url == null) return;
View gist:1310207
#!/usr/bin/env python
# Copyright 2010 Facebook
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
You can’t perform that action at this time.