Skip to content

Instantly share code, notes, and snippets.

View tmaslen's full-sized avatar

Tom Maslen tmaslen

View GitHub Profile
@tmaslen
tmaslen / gist:8845924
Last active August 29, 2015 13:56
Example of adding a right to left class depending on language
<%
var className = "";
if (["ar", "es"].indexOf(translations[vocab_dir].lang) > -1) {
className = "rtl";
}
%>
<body class="<%= className %>">
...
@tmaslen
tmaslen / gist:8999703
Created February 14, 2014 11:40
ruby lols
env -l
env: illegal option -- l
usage: env [-i] [name=value ...] [utility [argument ...]]
jake:responsive-news maslet02$ man env
jake:responsive-news maslet02$
jake:responsive-news maslet02$ env list
env: list: No such file or directory
jake:responsive-news maslet02$ env help
env: help: No such file or directory
jake:responsive-news maslet02$ env
# window.onerror
Not needed anymore now dev tools are so sophisticated, you can tell the browser to pause on error and then get a full stack trace and a list of all variables in the current scope.
# Don't tell people to do this:
```
var calc = function calc (a, b) { return a * b; }
```
@tmaslen
tmaslen / gist:8a9e1f879a0c4a50146c
Created June 10, 2014 18:57
Telegraph interactive loading. If mobile adds a link to open in seperate window, if desktop adds the interactive with an iframe.
// http://www.telegraph.co.uk/sport/football/world-cup/10886068/England-World-Cup-team-selector.html
<script type="text/javascript">
var parentElm = document.getElementsByTagName('script'),
domOutput = document.createElement('div');
parentElm = parentElm[ parentElm.length-2 ];
if(Telegraphics.Modernizr.mobileonmobilesite) {
var lnk=document.createElement('link');
lnk.setAttribute('rel','stylesheet');
lnk.setAttribute('type','text/css');
<script>
if ((!document.addEventListener) || (!Array.prototype.indexOf) || (!Array.prototype.forEach) ) {
document.write('<sc' + 'ript src="http://local.bbc.co.uk:1031/news/special/2014/newsspec_7978/content/english/js/lib/vendors/legacy-ie-polyfills.js?v=0.1.0"></sc' + 'ript>');
}
</script>
<div>
<a href="http://local.bbc.co.uk:1031/news/special/2014/newsspec_7978/content/english/frame_1.html?v=0.1.0" id="responsive-iframe-98623215" data-static-iframe-height="600">iFrame</a>
</div>
<div>
@tmaslen
tmaslen / gist:d141e0e25e0beb807fc3
Created July 18, 2014 13:19
notes for a potential presentation about the iframe scaffold
iframe scaffold
===============
## The problems
* current stuff keeps breaking on responsive
* need to deploy our work to apps
* We're going to move away from our existing infrastructure
Also:

it appears that the URL(s) in question relate(s) to matters of substantial interest to the public regarding your professional life

Its the opinion of a child, they may be interesting to the public but they are massively subjective and potentially reputationaly damaging. My partner has some of the highest exam grades in the school - this is not subjective, but the results are not published to the web with her name associated to them. She is strict so some of the pupils don't like her despite the results she gets and yet these children can dirty her reputation with a single, anonymous comment.

These URLs appear at the top of google searches for her name. And they were also written a long time ago. How can you allow this to happen to a teacher, a person of the highest integrity who gives everything to her profession for the betterment of society.

I'm massively disappointed in Google, cases like this are the reason why this law was created.

Regards, Tom Maslen.

What we do, who we are
BBC :: News :: Visual Journalism :: Dev Team
> Team of 9 developers and 1 tester responsible for
> BUILDING and SUPPORTING Visual Journalism's WEB CONTENT
There are THREE WORKFLOWS:
* DAILY TASKS Very quick, normally predefined, tasks that a developer will do at
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
<head profile="http://dublincore.org/documents/dcq-html/">
<title>Change Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="" id="changepw" name="changepw" method="post">