Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / introrx.md
Last active May 9, 2024 07:59
The introduction to Reactive Programming you've been missing
@nateabele
nateabele / angular-autoload.js
Created May 20, 2013 03:43
A simple, naïve, and hacky proof-of-concept for auto-loading modules in AngularJS.
/**
* Naive AngularJS module autoloader; depends on require.js.
*
* Usage:
*
* angular.autoLoad({
* 'ngResource': '/js/angular-resource-1.0.1.min.js',
* 'google-maps': '/js/angular-google-maps.js',
* 'ui.bootstrap': '/js/ui/ui-bootstrap-custom-tpls-0.4.0.min.js',
* 'module.split.over.multiple.files': ['/js/file1.js', '/js/file2.js']
@passy
passy / yeoman_compass.md
Last active January 7, 2016 19:24
Using Yeoman with Compass Sprites

Yeoman + Compass Sprites

Setup

generator-webapp has support for compass out of the box. However, in order to use one of my favorite features of it — sprites and the image_url helper — you have to make some adjustments to the Gruntfile.

Let's assume you use a SASS stylesheet like this one:

@import "design/*.png"
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// 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!"
@mandrasch
mandrasch / directive.js
Created April 26, 2012 10:55
JqueryFileUpload Directive (Beware quick & dirty!)
/* jqueryFileUpload-Plugin
https://github.com/blueimp/jQuery-File-Upload */
MYANGULARAPP.directive('myJqueryfileupload', function(){
return{
restrict:'E',
compile:function(el,attrs){
var compiler = this;
var elem = el;
// 2DO: serialize it from json?
@tmaiaroto
tmaiaroto / cron.php
Created April 20, 2012 18:12
Lithium Cron Wrapper
<?php
/**
* This script is meant to be executed via crontab.
* It should help you easily set li3 commands as cron jobs.
*
* You should put this in the root of your application.
* However, you don't need to, but you would then need to
* pass a --path= option with the path to your app.
* This is because the li3 console command must be called
* from a specific location.
@mehlah
mehlah / li3.vim
Created April 16, 2012 14:01
vim color scheme, the Lithium style !
" Vim color file
" Maintainer: Mehdi Lahmam B. (mehlah)
" Inspired by Li3 color scheme - http://dev.lithify.me/lithium/wiki/about/visual-identity
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@nateabele
nateabele / media.php
Created February 17, 2012 17:44
An example of how to completely reconfigure Lithium's templating engine
<?php
use lithium\net\http\Media;
/**
* This re-maps your template paths so you can have stuff like `pages/users_{username}.php`
* instead of the Lithium default.
*/
Media::type('html', 'text/html', array(
'view' => 'lithium\template\View',
@nateabele
nateabele / routes.php
Last active June 16, 2017 13:05
Lithium continuation route examples
<?php
/**
* Continuation routing examples. Handles URLs in the following forms:
*
* /posts
* /en/posts
* /admin/posts
* /admin/en/posts
* /admin/en/posts.json
* /admin/en/posts/4ef16ccc7f8b9aa331000064.json