Skip to content

Instantly share code, notes, and snippets.

View chrisfrancis27's full-sized avatar
Verified beard

Chris Francis chrisfrancis27

Verified beard
View GitHub Profile
<html class="<%= FeatureToggles.GetCssClassesForFeatures('en') %>">
<html class="feat-AccountRegistrationTools feat-SidebarNav">
@chrisfrancis27
chrisfrancis27 / Preferences.sublime-settings
Last active December 20, 2015 23:08
Sublime Text 3 user settings (Ubuntu)
{
"font_face": "UbuntuMono",
"font_size" : 12,
"tab_size" : 2,
"translate_tabs_to_spaces": true,
"detect_indentation": false,
"draw_minimap_border": true,
"always_show_minimap_viewport": true,
"caret_style": "smooth",
"line_padding_top": 2,
@chrisfrancis27
chrisfrancis27 / main.js
Created August 15, 2013 11:14
JS module conditional feature toggle
// If 'sidebarNav' feature is toggled ON...
if ($('html').hasClass('.feat-sidebarNav')) {
// Load the new SidebarNav module
require(['modules/sidebar'], function(SidebarNav) {
// ...
});
}
@chrisfrancis27
chrisfrancis27 / SublimeLinter.sublime-settings
Created August 17, 2013 10:26
Sublime Text 2 SublimeLinter plugin settings
{
"sublimelinter_gutter_marks_theme": "hard",
"jshint_options":
{
// Enforcement options
"curly" : true,
"eqeqeq" : true,
"forin" : true,
"immed" : true,
"latedef" : true,
@chrisfrancis27
chrisfrancis27 / positionFixedMediaQuery.css
Last active December 25, 2015 12:39
CSS "position:fixed" media query HACK (for use with Modernizr)
/* Basically a gnarly hack to try and roughly detect Android <= 2.3 without UA sniffing */
@media screen and (-webkit-min-device-pixel-ratio: 1.0) { /* Can't use ratio 1.5 as original Galaxy S was too low res */
.no-csstransforms3d .someFixedPositionClass { /* Android > 2.3 supports 3D transforms */
position: absolute; /* Fixed not supported, use absolute instead, or whatever */
}
}
@chrisfrancis27
chrisfrancis27 / globals-are-bad.js
Created October 29, 2013 15:16
Find all the shitty globals on your window object.
for (var k in Object.keys(window)) {
console.log(Object.keys(window)[k], window[Object.keys(window)[k]])
}
@chrisfrancis27
chrisfrancis27 / Gruntfile.js
Created November 9, 2013 17:10
A pretty decent little grunt file with production and dev configurations. Useful for pre-compiling Jade and Stylus, minifying / combining CSS and JS.
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Clean the build output directory before we begin
clean : {
options: {
force : true
},
@chrisfrancis27
chrisfrancis27 / gist:35c6e557b46b5a5d5369
Created February 17, 2016 16:14 — forked from guilherme/gist:9604324
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@chrisfrancis27
chrisfrancis27 / pre-commit
Created February 17, 2016 20:47
Git pre-commit hook for warning about new occurrences of a string, e.g. "// TODO"
#!/bin/bash
# Change $stopword to whatever string you want to disallow
# N.B. It's going into a regex, so don't be ridiculous.
stopword="TODO"
########################################
# You shouldn't need to touch anything #