Skip to content

Instantly share code, notes, and snippets.

$("body").append("Hello world");
@bensmithett
bensmithett / gist:1392431
Created November 24, 2011 22:25
sass vs css
.header {
a {
// styles
&:hover,
&:focus {
// styles
}
}
}
@bensmithett
bensmithett / gist:1755721
Created February 6, 2012 23:03
form layout
<div class="inputgroup">
<label for="someinput">Blah</label>
<div class="inputs">
<input type="text" name="someinput" id="someinput" />
<!-- more inputs + paragraphs, smalls, whatever! -->
</div>
</div>
@bensmithett
bensmithett / example.js
Created February 22, 2012 23:27
jQuery event maps with delegation?
var $container = $(".container");
// Woo delegated event handlers (but I have to call on() twice)
$container.on("click", ".control1", function () {
// blah
});
$container.on("mouseleave", ".control2", function () {
// blah
});
@bensmithett
bensmithett / form.html
Created March 1, 2012 22:57
Form layout
<ol>
<li class="inputgroup">
<label for="someinput">Blah</label>
<div class="inputs">
<input type="text" name="someinput" id="someinput" />
<!-- more inputs + paragraphs, smalls, whatever! -->
</div>
</li>
<!-- etc etc -->
</ol>
@bensmithett
bensmithett / gist:4030944
Last active September 12, 2020 12:44
Convert an image sequence to a 1080p video
brew install ffmpeg
ffmpeg -start_number 079 -y -r 30 -i "DSC_0%03d.JPG" -vf scale=1920:-1,crop=1920:1080 -vcodec libx264 -b:v 10000k -r 30 outputhd.m4v
# Optional bits
# -start_number: the first number in the sequence (default: 0)
# -y: overwrite output files without asking
# -r: input framerate (i.e. photos per second. The second -r is the output framerate)
# -i: input files. %03d = 3 digits (so this example would use DSC_0079.JPG - DSC_0999.JPG)
# Picked 10000k for the bitrate based on https://support.google.com/youtube/answer/1722171?hl=en
function is_palindrome(str) {
str = str.toString();
return str === str.split('').reverse().join('');
}
/*
// Usage...
is_palindrome('racecar'); // true
is_palindrome(45654); // true
@bensmithett
bensmithett / gist:4470916
Created January 6, 2013 23:02
comments demo
https://dl.dropbox.com/u/34233166/Screen%20Shot%202013-01-07%20at%2010.00.04%20AM.png
https://dl.dropbox.com/u/34233166/Screen%20Shot%202013-01-07%20at%2010.01.58%20AM.png

SMACSS + Sass + BEM

SMACSS

Scalable and
Modular
Architecture for
C
S
S

@bensmithett
bensmithett / travel_problems.md
Last active December 16, 2015 12:29
Travel Problems

I just got back from 4 weeks traveling. I took an iPhone and an iPad, but didn't take my laptop and for the whole time completely ignored the world of web development.

  • Didn't visit GitHub
  • Didn't read any dev blog posts
  • Looked at Twitter once or twice for about 30 seconds (and realised if I wasn't in this industry I probably wouldn't use it at all)
  • Deleted pretty much every email I received without reading it.

I still used the internet though.

I pulled out my phone whenever I needed directions, opening hours or prices. I did some banking & flight booking. I checked train timetables. Occasionally I posted an update to Facebook or a photo to Instagram. I read the odd news article.