Skip to content

Instantly share code, notes, and snippets.

View wgallios's full-sized avatar

William Gallios wgallios

View GitHub Profile
@wgallios
wgallios / selectOnClick
Created September 15, 2014 06:24
AngularJS Directive to select all on-click for an input
app.directive('selectOnClick', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on('click', function () {
this.select();
});
}
};
});
@wgallios
wgallios / alertsManager.js
Last active August 29, 2015 14:06
Angular.js service to manage alerts - used primarily with ui.bootstrap
/**
* Author: William Gallios <[email protected]>
*
* License: MIT
*
* @param msg - Alert Message
* @param type (optional) - warning|success|danger|info
* @param header (optional) - header of alert
*
* Usage: alertsManager.addAlert('You're doing a great yob!', 'success', 'Wow!');
@wgallios
wgallios / auth.js
Created September 13, 2014 04:45
Node.js/total.js authorization module example
// MIT License
// Copyright Peter Širka <[email protected]>
// Version 1.02
var events = require('events');
var SUGAR = 'AtH101s84';
var USERAGENT = 20;
// expireCookie in days
// expireSession in minutes
@wgallios
wgallios / ng-really.js
Last active August 29, 2015 14:06 — forked from asafge/ng-really.js
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
@wgallios
wgallios / .bashrc
Last active August 29, 2015 14:03
custom .bashrc stuff
# changes "ls" functionality to include flags "ls -AlFh"
if [ "$TERM" != "dumb" ]; then
eval `dircolors -b`
export LS_OPTIONS='-AlFh --color=always'
alias ls='ls $LS_OPTIONS'
fi
alias lsd='ls -AlFh --color | grep ^drw'
alias lsnd='ls -AlFh --color | grep -v ^drw'
alias cleanvim='find . -name "*.swp" -type f -delete'
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/