Skip to content

Instantly share code, notes, and snippets.

@andyj
andyj / whatEnvironment.js
Created September 22, 2013 21:25
Node.js output environment setting
console.log(process.env.NODE_ENV);
@andyj
andyj / newBashProfile.sh
Last active December 23, 2015 16:39
Create new ~/.bash_profile on the mac
# create the ~/.bash_profile
touch ~/.bash_profile
# Set the environment variable
echo export NODE_ENV=production >> ~/.bash_profile
# The source command makes the NODE_ENV variable available in your current shell
source ~/.bash_profile
# Check it works
@andyj
andyj / example_yepnojs.js
Created July 6, 2013 06:59
Example of yepnope test object
yepnope([{
test : /* boolean(ish) - Something truthy that you want to test */,
yep : /* array (of strings) | string - The things to load if test is true */,
nope : /* array (of strings) | string - The things to load if test is false */,
both : /* array (of strings) | string - Load everytime (sugar) */,
load : /* array (of strings) | string - Load everytime (sugar) */,
callback : /* function ( testResult, key ) | object { key : fn } */,
complete : /* function */
}, ... ]);
@andyj
andyj / javascript_fallback_solution.htm
Created July 6, 2013 06:53
CDN Javascript fallback solution
<!-- Try and load your CDN jQuery file-->
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<!-- Check for jQuery to be load, if not load in local copy -->
<script>
// n.b. \x3C is hexadecimal for <. You put this in their so the browser does not stop parsing the block of code
window.jQuery || document.write('<script src="/assets/js/jquery-1.10.2.min.js">\x3C/script>')
</script>
@andyj
andyj / p3p cfheader.cfm
Created May 28, 2013 14:32
A P3P policy to make IE handle session variables within an iFrame
<!--- A P3P policy to make IE handle session variables within an iFrame --->
<cfheader name="P3P" value="CP='NOI DSP NID TAIo PSAa OUR IND UNI OTC TST'" />
@andyj
andyj / web service error fixed.cfm
Created May 25, 2013 23:10
fixed the error "Fatal Error: URI=https://www.someurl.co.uk/RegService.asmx Line=110: The element type "p" must be terminated by the matching end-tag " by adding ?wsdl to the URL
<cfscript>
wsUrl = "https://www.someurl.co.uk/RegService.asmx?wsdl";
ws = CreateObject("webservice", wsUrl );
</cfscript>
@andyj
andyj / web service error.cfm
Last active December 17, 2015 18:09
Fatal Error: URI=https://www.someurl.co.uk/RegService.asmx Line=110: The element type "p" must be terminated by the matching end-tag "
<cfscript>
wsUrl = "https://www.someurl.co.uk/RegService.asmx";
ws = CreateObject("webservice", wsUrl );
</cfscript>
@andyj
andyj / readme.md
Created October 15, 2012 23:07
blogcfc2html readme.md

To install

$ git clone https://github.com/andyj/blogcfc2html.git
$ cd blogcfc2html
$ npm install

Once set up you need to edit the MySQL and outPath settings in the config.js file

@andyj
andyj / disableForm.js
Created July 11, 2012 16:04
Disabling a whole form
// add the class "disabled" to the form
$("form.disabled").find("input:not(:disabled), select:not(:disabled), textarea:not(:disabled)").prop("disabled",true);
@andyj
andyj / gist:2355649
Created April 10, 2012 23:37
Express, Less and less-middleware
$ mkdir expressWithLess && cd expressWithLess
$ express --css less-middleware && npm install
$ mv public/stylesheets/ public/styles
$ nano public/styles/style.less
@color: #00B7FF;
body { padding: 200px; font: 18px "Lucida Grande", Helvetica, Arial, sans-serif; }