Skip to content

Instantly share code, notes, and snippets.

View luismanolo's full-sized avatar

luismanolo luismanolo

  • San Vicente de la Sonsierra, Spain
View GitHub Profile
@Rob-ot
Rob-ot / Draggable.js
Created December 16, 2011 23:46
Draggable and dropable views for backbone, uses html5 drag and drop api, requires jquery and underscore, not tested in IE yet
return View.extend({
initialize: function () {
this.el.attr("draggable", "true")
this.el.bind("dragstart", _.bind(this._dragStartEvent, this))
},
_dragStartEvent: function (e) {
var data
if (e.originalEvent) e = e.originalEvent
e.dataTransfer.effectAllowed = "copy" // default to copy
@IlianIliev
IlianIliev / fabfile.py
Created May 28, 2012 11:04
Fabric script that eases the creation of new Django Project
"""
This fabric script automates the creation of a virtual environment and a Django
project. The result will be virtual environtment with the name of the project.
The folder namer where the project code will be placed is specified in
SOURCE_DIRECTORY_NAME, a static root folder will be created and settings.py
will be updated.
"""
try:
from fabric.api import env, run, local
from fabric.context_managers import lcd, prefix
@crtr0
crtr0 / client.js
Created June 8, 2012 17:02
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@border
border / mgoExample.go
Created August 27, 2012 15:33
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@tbjers
tbjers / menu.js
Created September 3, 2012 17:12
Express resources with authentication middleware
module.exports = {
menu: {
'wall': { title: 'Wall', name: 'wall' },
'logs': { title: 'Logs', name: 'logs', submenu: {
'system': { title: 'System', name: 'system' }
} },
'stats': { title: 'Stats', name: 'stats' },
'admin': { title: 'Admin', name: 'admin', submenu: {
'users': { title: 'Users', name: 'users' },
'grants': { title: 'Grants', name: 'grants' }
@guillaumepiot
guillaumepiot / gist:3939452
Created October 23, 2012 15:28
ANGULARJS - Django CSRF Token header setup
var myApp = angular.module('myApp').config(function($httpProvider) {
$httpProvider.defaults.headers.post['X-CSRFToken'] = $('input[name=csrfmiddlewaretoken]').val();
});
@bennadel
bennadel / slide-show.htm
Created January 4, 2013 20:57
Creating A Custom Show / Hide Directive In AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>Creating A Custom "Show" Directive In AngularJS</title>
<style type="text/css">
ul {
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) {
$scope.albums = [];
$scope.artists = [];
var terms = new Rx.Subject();
$scope.searchMusic = terms.onNext.bind(terms);
terms.sample(250)
@codeboyim
codeboyim / index.html
Last active September 15, 2016 09:06
Get ReactJS and Foundation.js Work Together demo: http://jsbin.com/lukako/8
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Get React and Foundation Work Together" />
<link href="http://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/css/normalize.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/css/foundation.min.css" rel="stylesheet" type="text/css" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/js/vendor/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/js/foundation.min.js"></script>
<script src="http://fb.me/react-0.11.0.js"></script>
<meta charset="utf-8">
@cyrusboadway
cyrusboadway / google-domains-dynamic-dns-update.sh
Created February 20, 2016 17:21
Script to update a Google Domains DNS record
#!/bin/bash
### Google Domains provides an API to update a DNS "Syntheitc record". This script
### updates a record with the script-runner's public IP, as resolved using a DNS
### lookup.
###
### Google Dynamic DNS: https://support.google.com/domains/answer/6147083
### Synthetic Records: https://support.google.com/domains/answer/6069273
USERNAME=""