Skip to content

Instantly share code, notes, and snippets.

View larvanitis's full-sized avatar

Leonidas Arvanitis larvanitis

  • Athens, Greece
View GitHub Profile
@larvanitis
larvanitis / stateChangeDebugging.js
Created June 23, 2015 09:35
Event logging for AngularJS $location and ui-router $state change.
angular.module('myModule').run(function ($rootScope, $state) {
/* ENTRY EVENTS */
$rootScope.$on('$locationChangeStart', function (event, toUrl, fromUrl, toHistoryState, fromHistoryState) {
console.groupCollapsed('$locationChangeStart');
console.debug('event:', event);
console.debug('toUrl:', toUrl);
console.debug('fromUrl:', fromUrl);
console.debug('toHistoryState:', toHistoryState);
@larvanitis
larvanitis / Yeoman-ng_gen.xml
Last active December 17, 2015 09:29
Webstorm / IDEA :: External Tools :: Yeoman angular:* generators (w/o --coffee or --minsafe) Installation: drop in ~/.WebStorm6/config/tools/
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Yeoman[ng]">
<tool name="Create Route" description="Generates a controller and view, and configures a route in app/scripts/app.js connecting them." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="yo" />
<option name="PARAMETERS" value="angular:route $Prompt$" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
<tool name="Create Controller" description="Generates a controller in app/scripts/controllers." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
@larvanitis
larvanitis / rtorrentd
Created November 17, 2012 10:31
RTORRENT::Daemon setup / init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start rtorrent as a daemon
### END INIT INFO
@larvanitis
larvanitis / filter_on_mimetype-slimmed.sh
Created November 16, 2012 16:15
BASH::Filter file on mimetype
#!/bin/bash
# make sure the file exists and that it's a regular file before proceeding
[ -z "$1" ] && echo "you must specify a file!" >&2 && exit 1
[ ! -e "$1" ] && echo "$1 doesn't exist!" >&2 && exit 1
[ ! -f "$1" ] && echo "$1 is not a regular file!" >&2 && exit 1
FILE=$1
FILE_MIME=$(file -b --mime-type "$FILE") #or "xdg-mime query filetype"
VALID_MIMETYPES=(
"application/octet-stream" #bmp image