Skip to content

Instantly share code, notes, and snippets.

@apendleton
apendleton / twproxy.py
Created January 13, 2012 05:52
Twitter public timeline proxy for testing -- depends on flask
import urllib2, json, random, sys
from flask import Flask, request, make_response
app = Flask(__name__)
TIMELINE_DATA = None
@app.route('/public_timeline.json')
def public_timeline():
out = json.dumps(sorted(TIMELINE_DATA, key=lambda x: random.random()))
if 'callback' in request.args:
@amdest
amdest / gist:2935783
Created June 15, 2012 10:35
Twitter Bootstrap modal auto-width
// https://github.com/twitter/bootstrap/issues/675#issuecomment-6184243
$('#feedback-modal').modal({
backdrop: true,
keyboard: true
}).css({
'width': function () {
return ($(document).width() * .9) + 'px';
},
'margin-left': function () {
@aristofor
aristofor / makefile
Created June 28, 2012 10:22
custom bootstrap makefile
# makefile pour thème bootstrap personnalisé
#
# usage dans un makefile supérieur:
# $(MAKE) ${MAKEFLAGS} BUILD_DIR=${BUILD_DIR}/theme BOOTSTRAP_SOURCE=${BOOTSTRAP_SOURCE}
# ou dans ce makefile:
# BUILD_DIR=./build
# BOOTSTRAP_SOURCE=${HOME}/src/bootstrap
#
# bootstrap 2.1.0-wip utilise normalement `recess`
# `lessc` permet de surcharger localement des .less (option "--include-path")
@saniko
saniko / app.js file
Created October 11, 2012 16:59
a very simple bootstrap boilerplate for building backbone.marionette based on require.js
define([
'jquery',
'underscore',
'backbone',
'marionette',
'handlebars',
'text!templates/app_view.html',
'modules/mainMenuView/mainMenuView',
@webgio
webgio / app.coffee
Last active December 10, 2023 10:24
Marionette.js module to manage authentication. Needs a server method that checks credentials returning true or false. Started from this blog post code: http://clintberry.com/2012/backbone-js-apps-authentication-tutorial/
App = new Marionette.Application();
App.addRegions {
"headerRegion": "#header"
"topMenuRegion": "#top-menu"
"mainRegion" : "#main"
}
App.on 'initialize:after', ->
Backbone.history.start()
@mattkahl
mattkahl / twig.async.js
Last active March 16, 2017 08:23
An asynchronous implementation of twigjs that returns a Promise on instantiation if the template is asynchronous. Works just like twig(), but when instantiated, twigAsync returns a Promise. The twig template is passed as the only parameter when resolving the Deferred object.
/**
* twig.async.js
*
* An asynchronous implementation of twigjs that returns a Promise on instantiation if the template is asynchronous.
* Works just like twig(), but when instantiated, twigAsync returns a Promise. The twig template
* is passed as the only parameter when resolving the Deferred object.
*
* e.g.
* tpl = twigAsync({href:'/templates/profile/profile-welcomeNewDesign.twig'});
* $.when(tpl).done(function(twigTemplate){
@dkleehammer
dkleehammer / app.js
Created July 31, 2013 22:08
Backbone/Marionette JS session handling example
define([
'marionette',
'router',
'controller',
'modules/auth',
'modules/vent',
'views/_layout'
], function(Marionette, Router, Controller, Auth, Vent, Layout){
var App = new Marionette.Application();
@tnajdek
tnajdek / fabfile.py
Created October 6, 2013 19:04
Fabfile for a python backend, js frontend project;
# -*- coding: utf-8 -*-
import logging
import os
from os.path import abspath, dirname, join
from os import environ
from fabric.api import env, task
from fabric.operations import local
from fabric.operations import sudo
from fabric.utils import puts
@Fasani
Fasani / Simple-Backbone-WordPress-Example.html
Last active February 4, 2022 04:38
A simple Backbone WordPress Example. Using JSON API plugin. (http://wordpress.org/plugins/json-api/)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Simple Backbone WordPress Example</title>
<link rel="stylesheet" href="base.css">
</head>
<body>
<ul id="post-list"></ul>
define([
'backbone',
'application',
'apps/my-app-mod/layout/my-app-mod-layout',
'apps/my-app-mod/my-app-mod-list',
'apps/my-app-mod/item/message-view',
'apps/my-app-mod/my-app-mod'
], function(Backbone, app, MyAppModLayout, MyAppModListController, MessageView, AppRouter) {
'use strict';