# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Requirements: jQuery | |
// Installation: Add this to your tinyMCE.init, put in your button image and your Embed.ly key and you're good to go | |
// This is just a very simple embed.ly button cause Google turned up squat. | |
setup : function(ed) { | |
ed.addButton('myembedly', { | |
title : 'Embed.ly', | |
image : 'BUTTON IMAGE', | |
onclick : function() { | |
var url = prompt("Enter URL to embed"); | |
if (url == null) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
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 Brunch.io but where Brunch is not suited I needed a small wrapper to do this for me.
Usage:
chmod +x watchjs.py
./watchjs.py <directory> <output filename>