This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.config(function($httpProvider) { | |
$httpProvider.interceptors.push(function($rootScope, $location, $q) { | |
return { | |
'request': function(request) { | |
// if we're not logged-in to the AngularJS app, redirect to login page | |
$rootScope.loggedIn = $rootScope.loggedIn || $rootScope.username; | |
if (!$rootScope.loggedIn && $location.path() != '/login') { | |
$location.path('/login'); | |
} | |
return request; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema "DB Name", | |
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" | |
FROM information_schema.tables | |
GROUP BY table_schema; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -iname '*.js'|grep -v -E "^./(dev|node_modules|components|(public/js/((angular|bootstrap|jquery|underscore|modernizr|tiny_mce))))"|xargs wc -l|less |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: tones.h | |
* Author: [email protected] | |
* | |
* Created on 13 December 2012, 9:01 AM | |
* | |
* Audio tone frequencies expressed as Hz | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#_______________________________________________________________________________ | |
# | |
# edam's Arduino makefile | |
#_______________________________________________________________________________ | |
# version 0.4 | |
# | |
# Copyright (C) 2011, 2012 Tim Marston <[email protected]>. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################## | |
leostick12.name=Freetronics LeoStick V1.2 | |
leostick12.upload.protocol=arduino | |
leostick12.upload.maximum_size=28672 | |
leostick12.upload.speed=1200 | |
leostick12.bootloader.low_fuses=0xde | |
leostick12.bootloader.high_fuses=0xd8 | |
leostick12.bootloader.extended_fuses=0xcb | |
leostick12.bootloader.path=diskloader | |
leostick12.bootloader.file=DiskLoader-LeoStick.hex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an SQL file that will drop all non-system databases | |
mysql -u root -p -e "show databases" | grep -v Database | grep -v mysql| grep -v information_schema| grep -v test | grep -v OLD |gawk '{print "drop database " $1 ";select sleep(0.1);"}' > drop_all_databases.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful if you need a list of files in CSV or for pasting into a dictionary | |
ls |sed 's/\(.*\)/"\1",/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); | |
return v.toString(16); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Extends the Date object to get number of seconds since UNIX epoch | |
instead of milliseconds as with .getTime() | |
*/ | |
Date.prototype.getTimestamp = function() { | |
return Math.round(this.getTime()/1000); | |
} |