Skip to content

Instantly share code, notes, and snippets.

@andyj
andyj / html_for_international_calling coes.htm
Created October 22, 2013 21:57
HTML <select> international calling codes for each country
<!-- country codes (ISO 3166) and Dial codes. -->
<select name="countryCode" id="">
<option data-countryCode="GB" value="44" Selected>UK (+44)</option>
<option data-countryCode="US" value="1">USA (+1)</option>
<optgroup label="Other countries">
<option data-countryCode="DZ" value="213">Algeria (+213)</option>
<option data-countryCode="AD" value="376">Andorra (+376)</option>
<option data-countryCode="AO" value="244">Angola (+244)</option>
<option data-countryCode="AI" value="1264">Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">Antigua &amp; Barbuda (+1268)</option>
@andyj
andyj / Application.cfc
Last active August 29, 2015 13:56
sameFORMFieldsAsArray in Railo
component output="false" {
this.name="test";
this.sameFORMFieldsAsArray = true;
public function onApplicationStart() output="false"{
return ;
}
public boolean function onRequestStart(required string thePage) output="true"{
return true;
}
@andyj
andyj / app.js
Last active August 29, 2015 14:05
node.sessions
var settings = require('./settings')
var express = require('express')
var session = require('express-session')
var app = express()
var MongoStore = require('connect-mongo')(session);
var links = '<p><a href="/link1">Link1</a> <a href="/link2">Link2</a> <a href="/link3">Link3</a></p>';
/*
Failure to set "saveUninitialized" and "resave" will generate two warnings:
@andyj
andyj / app.js
Created September 3, 2014 08:50
Parsing CSV in node.js
// Call this via CLI with $ node app.js /PathTo/Your.csv
var parse = require('csv-parse');
var fs = require('fs');
process.argv.forEach(function (val, index, array) {
/*
Position 0 == node, poistion 1 == app.js (full path) thats why we check we
need to check for args from index 2 onwards
*/
if( index > 1){
@andyj
andyj / gist:e67a85eb8bb6ff375874
Last active August 29, 2015 14:14
stacktrace - NoClassDefFoundError
java.lang.NoClassDefFoundError "railo/loader/util/Util"
railo/loader/util/Util at railo.extension.io.log.sl4j.LoggerAdapterConsole.getStacktrace(LoggerAdapterConsole.java:119):119
at railo.extension.io.log.sl4j.LoggerAdapterConsole.log(LoggerAdapterConsole.java:64):64
at railo.extension.io.log.sl4j.LoggerAdapterConsole.error(LoggerAdapterConsole.java:54):54
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:222):222
at lucee.runtime.orm.hibernate.HibernateSessionFactory.schemaExport(Unknown Source):-1
at lucee.runtime.orm.hibernate.HibernateSessionFactory.createConfiguration(Unknown Source):-1
at lucee.runtime.orm.hibernate.SessionFactoryData.setConfiguration(Unknown Source):-1
at lucee.runtime.orm.hibernate.HibernateORMEngine.getSessionFactoryData(Unknown Source):-1
@andyj
andyj / ubunut-*.nix-cheat-sheet.md
Last active September 7, 2015 21:32 — forked from anonymous/ubunut-*.nix-cheat-sheet
Ubuntu / *nix cheat sheet

##File size

Display the biggest top-20 directories

du -ah . | sort -rh | head -20

Display largest files

find [directory i.e. ~/] -type f -printf "%s - %p\n" | sort -n | tail -n 100

@andyj
andyj / ColdFusion-hash-in-javascript.js
Created October 8, 2015 10:05
Replicating ColdFusion hash() function in Javascript
var crypto = require('crypto');
var pwd = "Password1!";
var hash = function(str){
return crypto.createHash('sha256').update(pwd).digest('hex').toUpperCase()
}
console.log( hash(pwd) );
@andyj
andyj / find-and-kill.sql
Created October 13, 2015 08:54
Transaction (Process ID) was deadlocked on lock - find and kill process
CREATE TABLE #Result
(
spid int,
ecid int,
status varchar(max),
loginname varchar(max),
hostname varchar(max),
blk varchar(max),
dbname varchar(max),
cmd varchar(max),
@andyj
andyj / isAddressUp-SoundAlarm.sh
Created October 26, 2015 22:21
Terminal script to sound alarm when an IP address is reachable again
pingAddress=google.com
while :
do
ping -t 2 -o pingAddress && say ping $pingAddress working
sleep 2
done
@andyj
andyj / isAddressDown-SoundAlarm.sh
Created October 26, 2015 22:25
Terminal script to sound alarm when an IP address is not reachable again
pingIpAddress=google.com
while :
do
ping -t 2 -o -c 1 $pingIpAddress || say ping to $pingIpAddress failing
sleep 2
done