Skip to content

Instantly share code, notes, and snippets.

@xtbl
xtbl / JavaScript context and this keyword
Created May 7, 2013 04:24
JavaScript this and context: usually the "this" refers to the window object as a parent, but in event handlers it refers to the element in which the event was called. Some examples.
// <a href="http://google.com">Click me</a>
function doSomething(e) {
e.preventDefault();
console.log(this);
}
var obj = {
doIt: function(e) {
e.preventDefault();
@xtbl
xtbl / Lightbox modal onLoad
Created April 12, 2013 14:22
Lightbox modal with onLoad and onClose events
menuMobilePtr.find("li.nav a").click(function() {
menuMobileModalPtr.lightbox_me({centered: true, overlayCSS: {background: "black", opacity: 0.65},
onLoad: function() {
$('body').css({
position: 'fixed',
width: '100%'
});
$('#menu-mobile-modal').css({
top:'10%',
height: '30%'
@xtbl
xtbl / module.js v1
Created March 30, 2013 04:28
module.js
var APP;
APP = (function(){
var myPrivateVariable = "my private content";
var application = {
init: function(){
console.log(myPrivateVariable);
},
//includes/mobile/base.html
<link rel="shortcut icon" href="http://www.xojane.com/sites/default/files/janepratt_favicon_1.png" type="image/x-icon" />
{% block head_canonical_url %}
<link rel="canonical" href="http://www.xojane.com/" />
{% endblock %}
// templates/mobile/article.html
{% import "includes/macros.html" as macros %}
{% block head_canonical_url %}
<link rel="canonical" href="{{macros.articleUrl(current_article, _conf.site_production_domain)}}" />
@xtbl
xtbl / .tmux.conf
Created October 30, 2015 22:01 — forked from snuggs/.tmux.conf
TMUX configuration file
##############################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
#############################
#
# COPY AND PASTE
@xtbl
xtbl / index.html
Created July 25, 2012 18:14
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Canvas Waterfall &middot; CodePen</title>
<!--
Copyright (c) 2012 xtobal, http://codepen.io/xtobal
Permission is hereby granted, free of charge, to any person obtaining
@xtbl
xtbl / index.coffeescript
Created July 25, 2012 18:09
A web page created at CodePen.io.
###
Text masked spring particles
Author: Kushagra Gour a.k.a. Chin Chang
(@chinchang457)
###
# requestanimationframe polyfill
window.requestAnimFrame = (->
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
@xtbl
xtbl / index.html
Created July 25, 2012 18:10
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Multiphase flow &middot; CodePen</title>
<!--
Copyright (c) 2012 Tim Holman, http://codepen.io/tholman
Permission is hereby granted, free of charge, to any person obtaining
@xtbl
xtbl / index.coffeescript
Created July 25, 2012 18:09
A web page created at CodePen.io.
###
Text masked spring particles
Author: Kushagra Gour a.k.a. Chin Chang
(@chinchang457)
###
# requestanimationframe polyfill
window.requestAnimFrame = (->
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
@xtbl
xtbl / index.coffeescript
Created July 25, 2012 18:09
A web page created at CodePen.io.
###
Text masked spring particles
Author: Kushagra Gour a.k.a. Chin Chang
(@chinchang457)
###
# requestanimationframe polyfill
window.requestAnimFrame = (->
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||