Skip to content

Instantly share code, notes, and snippets.

Adam Tuttle atuttle

Block or report user

Report or block atuttle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@atuttle
atuttle / _readme.md
Last active Oct 1, 2018
Push Packt Free Book of the Day alert into your slack channel
View _readme.md

Push alerts about the daily 🆓 Packt eBook into Slack

Install this globally. Yes, globally.

$ npm install -g scrape-html

Now create a local project somewhere:

@atuttle
atuttle / Gruntfile.js
Created Jun 10, 2016
My Browserify & Grunt config for React.js with LESSCSS
View Gruntfile.js
module.exports = function(grunt){
'use strict';
grunt.initConfig({
less: {
bundle: {
options: {
compress: true
,report: 'min'
View deORM.cfm
<cfscript>
function deORM( obj, depth = 1, depthLimit = 10 ){
var deWormed = {};
if (depth >= depthLimit){
return {};
}
if (isSimpleValue( obj )){
deWormed = obj;
}
else if (isObject( obj )){
@atuttle
atuttle / Cobalt2.spTheme
Created Apr 25, 2016
Cobalt2 theme (ported from the Sublime Text theme by @wesbos) for Sequel Pro: http://www.sequelpro.com/ -- save it as Cobalt2.spTheme and import it from your settings.
View Cobalt2.spTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
@atuttle
atuttle / EOL.cfm
Created Apr 18, 2016
Determining what char codes ACF uses on different operating systems
View EOL.cfm
<cfscript>
fn = "ram://eol.txt";
f = fileOpen( fn, "append", "utf-8" );
fileWriteLine( f, '1' );
fileWriteLine( f, '2' );
fileClose( f );
r = fileRead( fn );
chars = listToArray( r, '' );
View someReactComponent.js
var store = require('store') //my redux store
var unsubscribe
var MyComponent = React.createClass({
componentDidMount: function componentDidMount(){
unsubscribe = store.subscribe(function handleStateChange(){
// in ES6 we could do this: this.forceUpdate()
// but what is the solution for ES<6?
})
}
@atuttle
atuttle / .gitconfig
Created Mar 9, 2016
My ~/.gitconfig (with sensitive portions removed)
View .gitconfig
[color]
ui = auto
[core]
autocrlf = input
excludesfile = /Users/atcodes/.gitignore_global
[push]
default = tracking
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr,%an)%Creset' --abbrev-commit --date=relative
st = status -sb
@atuttle
atuttle / approach_a.cfc
Last active Jan 18, 2016
Which way is better? Why?
View approach_a.cfc
var messageStatus = new util.iQuery("
select
status
from
Message
where
messageId = :id
",{
id: { cfsqltype: "cf_sql_numeric", value: batch.messageId[1] }
});
@atuttle
atuttle / .jscsrc
Created Jul 1, 2015
My JSCS config and a sample of how it formats
View .jscsrc
{
"preset": "node-style-guide"
,"validateIndentation": "\t"
,"disallowAnonymousFunctions": true
,"disallowSpacesInsideParentheses": { "only": [ "{", "}" ] }
,"requireSpacesInsideParentheses": { "all": true, "except": [ "{", "}" ]
,"requireSpacesInsideBrackets": { "allExcept": [ "[", "]", "{", "}" ] }}
,"requireSpacesInsideObjectBrackets": "allButNested"
,"validateParameterSeparator": ", "
,"disallowCommaBeforeLineBreak": true
@atuttle
atuttle / timezones.cfm
Last active Dec 7, 2018
Dealing with Time Zones in ColdFusion
View timezones.cfm
<!---
Many thanks to Sean Corfield and Ryan Guill who set me down the correct path of java.util.TimeZone
--->
<cfscript>
writeDump(label="Conversion Examples",var={
"0-local-tz": getSystemTZ()
,"1-local-now": now()
,"2-utc-now": toUTC(now())
,"3-eastern-now": TZtoTZ( getSystemTZ(), now(), "America/New_York" )
You can’t perform that action at this time.