Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / blogcfc-export-to-ghost.sql
Last active December 25, 2015 19:59
Some SQL (mysql) for exporting from BlogCFC to Ghost (www.ghost.org)
-- This was tested on Ghost v0.3.0
-- I have 2 databases set up which I reference in my SQL - you need to change accordingly
-- 1: ajdev (this holds my BlogCFC data)
-- 2: ghost-dev (this holds my Ghost blog data)
--
-- 1) Check for duplicate alias's
-- I don't know how I got these but I did, so clean your entries up first but looking
-- for duplicates and changing the `alias` value to something unique.
SELECT lower(`alias`) , count(lower(`alias`) )
@andyj
andyj / pgdebug.htm
Created September 30, 2013 16:06
phonegap debug not working
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<script src="http://debug.phonegap.com/target/target-script-min.js#8A4EA003-A0B5-4683-BDD8-BF4CB521DAEA"></script>
</head>
<body>
@andyj
andyj / glyphicon_example.html
Created September 26, 2013 23:38
If you use Bootswatch files from the bootstrap CDN then to get the Glyphicons working you need to include glphicons css file @ http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css
<html>
<head>
<link href="//netdna.bootstrapcdn.com/bootswatch/3.0.0/flatly/bootstrap.min.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
</head>
<body>
<span class="alert alert-danger">Glyphicon example</span>
<hr>
<div class="the-icons">
<span class="glyphicon glyphicon-glass"></span>