Skip to content

Instantly share code, notes, and snippets.

Craig Myles cjmyles

  • Sydney Australia
Block or report user

Report or block cjmyles

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
@cjmyles
cjmyles / index.html
Created Oct 14, 2015
Explicit base tag for IE
View index.html
<!--[if IE]>
<script>document.write('<base href="' + window.location.protocol + '//' + window.location.host + '/" />');</script>
<![endif]-->
<![if !IE]>
<script>document.write('<base href="/" />');</script>
<![endif]>
@cjmyles
cjmyles / marionette_module.js
Last active Oct 14, 2015
Marionette Module
View marionette_module.js
'use strict';
var Backbone = require('backbone');
var Mn = require('backbone.marionette');
// var _ = require('underscore');
// var config = require('libs/config');
// var utils = require('libs/utils');
/**
@cjmyles
cjmyles / marionette_object.js
Last active Oct 14, 2015
Marionette: Object
View marionette_object.js
'use strict';
var Backbone = require('backbone');
var Mn = require('backbone.marionette');
// var _ = require('underscore');
// var config = require('libs/config');
// var utils = require('libs/utils');
/**
@cjmyles
cjmyles / marionette_view.js
Last active Oct 14, 2015
Marionette: View Template
View marionette_view.js
'use strict';
var Backbone = require('backbone');
var Mn = require('backbone.marionette');
// var _ = require('underscore');
// var config = require('libs/config');
// var utils = require('libs/utils');
/**
@cjmyles
cjmyles / private.js
Last active Aug 29, 2015
Private Members in Javascript
View private.js
function Test() {
var _secret = "12345";
// private method
function __private() {
return _secret;
}
// publicly accessible method and can access private vars & methods
this.priviledged = function() {
@cjmyles
cjmyles / utils-ie.js
Last active Aug 29, 2015
Utils - Internet Explorer version
View utils-ie.js
utils = {
ie: (function(){
var undef,
v = 3,
div = document.createElement("div"),
all = div.getElementsByTagName("i");
while (
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
all[0]
@cjmyles
cjmyles / utils-logging.js
Created Mar 4, 2014
Utils - Cross browser logging
View utils-logging.js
utils = {
log: function() {
this.__log("log", arguments);
},
info: function() {
this.__log("info", arguments);
},
warn: function() {
@cjmyles
cjmyles / comment.sublime-snippet
Last active Dec 29, 2015
Sublime snippet - Object function definition
View comment.sublime-snippet
<snippet>
<content><![CDATA[$1: function(){
$0
},]]></content>
<tabTrigger>fnc</tabTrigger>
<description>object function</description>
</snippet>
@cjmyles
cjmyles / consolelog.sublime-snippet
Last active Dec 28, 2015
Sublime snippet - console.log()
View consolelog.sublime-snippet
<snippet>
<!-- put this file in /packages/User/console_log.sublime-snippet -->
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>con</tabTrigger>
<description>console.log()</description>
</snippet>
You can’t perform that action at this time.