Skip to content

Instantly share code, notes, and snippets.

necolas / gist:2215692
Created March 27, 2012 13:12
Git submodules
# Workflow from
# Add the new submodule
git submodule add git:// vim/bundle/one-submodule
# Initialize the submodule
git submodule init
# Clone the submodule
git submodule update
# Stage the changes
git add vim/bundle/one-submodule
necolas / Composite-Link.js
Created September 19, 2018 23:02
Next.js links with React Native for Web
necolas /
Last active March 28, 2024 20:34
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.


necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
* Updated to use the function-based method described in
* Better handling of scripts without supplied ids.
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
necolas / Hoverable.js
Last active January 1, 2024 17:32
Hover styles in React Native for Web
import createHoverMonitor from './createHoverMonitor';
import { element, func, oneOfType } from 'prop-types';
import React, { Component } from 'react';
const hover = createHoverMonitor();
* Use:
* <Hoverable>
* {(hover) => <View style={hover && styles.hovered} />}
* This module is aliased to 'react-native' in our webpack config.
* RNW currently uses inline styles. Our existing CSS – written using `css-modules`
* and processed by `post-css` – needs to override RNW's default component styles
* when RNW is being used to render the app. A postcss transform was added to our
* webpack config to append `!important` to (almost) every CSS declaration.
import findNodeHandle from 'react-native-web/dist/modules/findNodeHandle';
necolas / rsync_backup
Created August 14, 2011 23:27
Maintain a bootable clone of Mac OS X volume
# rsync options
# -v increase verbosity
# -a turns on archive mode (recursive copy + retain attributes)
necolas / .htaccess
Created April 9, 2012 22:19
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
necolas / css-responsive-images.html
Created May 18, 2011 13:33
Idea for CSS-only responsive images using CSS3 generated content and attr() function. No browser implementation as of May 2011
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS responsive images</title>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {
necolas / stylesheet-injector.js
Created November 5, 2010 09:49
Create and append style sheets to document <head> using JavaScript
(function() {
var css = [
i = 0,
link = document.createElement('link'),
head = document.getElementsByTagName('head')[0],