Skip to content

Instantly share code, notes, and snippets.

View thomastuts's full-sized avatar

Thomas Tuts thomastuts

View GitHub Profile
@thomastuts
thomastuts / gist:6717157
Created September 26, 2013 17:03
AngularJS code convention: 2 ways of declaring controllers
/**
* WAY 1: ANGULARJS TUTORIAL
*/
// app.js
var myApp = angular.module('myApp',[]);
// controllers/greeting.js
myApp.controller('GreetingCtrl', ['$scope', function($scope) {
@thomastuts
thomastuts / PHP rewrite
Created July 10, 2013 20:39
Remove .php from extensions
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
@thomastuts
thomastuts / Gruntfile.js
Created May 13, 2013 09:53
Gruntfile with SCSS watcher
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);