Skip to content

Instantly share code, notes, and snippets.

View LeonardoGentile's full-sized avatar

LeonardoGentile

  • Jellysmack
  • Nice, France
View GitHub Profile
app.factory('API', function($http, $q){
var basePath = 'http://domain.com/api/path';
// => http://domain.com/api/path/foo/bar
function makeRequest(verb, uri, data){
var defer = $q.defer();
verb = verb.toLowerCase();
//start with the uri
(function() {
'use strict';
/**
* @ngdoc service
* @name myApp.loginService
* @description
* # loginService
*/
angular.module('myApp', []).provider('loginService', function() {
'use strict'
###*
# @ngdoc service
# @name myApp.loginService
# @description
# # loginService
###
angular.module('myApp', [])
.provider('loginService', () ->
@LeonardoGentile
LeonardoGentile / dabblet.css
Created September 2, 2014 15:52 — forked from telic/dabblet.css
Lined Paper
/**
* Lined Paper
*/
html {
background-color:white;
padding:10px;
font-family:sans-serif; font-size:15px;
}
body {

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@LeonardoGentile
LeonardoGentile / HTML(Angular).tmLanguage
Created January 19, 2015 09:07
language definition for HTML angular.js template syntax
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>html</string>
<string>htm</string>
<string>shtml</string>
<string>xhtml</string>
@LeonardoGentile
LeonardoGentile / PyCallGraph.py
Created April 21, 2015 15:52
PyCallGraph Middleware for python
import time
from django.conf import settings
from pycallgraph import Config
from pycallgraph import PyCallGraph
from pycallgraph import GlobbingFilter
from pycallgraph.output import GraphvizOutput
class CallgraphMiddleware(object):
@LeonardoGentile
LeonardoGentile / beautons.sass
Created May 7, 2015 22:30
beautons using BEM and Sass
// ----
// Sass (v3.3.0.rc.5)
// Compass (v1.0.0.alpha.18)
// ----
// Copied and Pasted from: http://sassmeister.com/gist/9228656
// that in turn was copied and pasted from Harry Roberts Beutons: http://github.com/csswizardry/beautons/blob/master/beautons.css
// Base

Intro

session-less use of jwt and passport.js

note: by module I mean either a javascript (.js) or coffeescript (.coffee) file

installation

install the following:

  • sailsjs
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"