Skip to content

Instantly share code, notes, and snippets.

View nickautomatic's full-sized avatar

Nick F nickautomatic

View GitHub Profile
@adactio
adactio / datalist.html
Created January 9, 2011 17:24
Progressive enhancement with datalist
<!DOCTYPE html>
<title>Datalist test</title>
<meta charset="utf-8">
<form>
<label for="source">How did you hear about us?</label>
<datalist id="sources">
<select name="source">
<option>please choose...</option>
<option value="television">Television</option>
<option value="radio">Radio</option>
@Plazmaz
Plazmaz / windir.sh
Last active June 15, 2019 01:34
This is a simple function for converting windows paths (C:\Users\Test\t.txt) to their WSL equivalent (/mnt/c/Users/Test/t.txt)
# !/bin/bash
function windir() {
echo "/mnt/$1" | sed -e 's/\\\\/\//g' -e 's/\b\(.\):/\L\1/g'
}
@arnaudbreton
arnaudbreton / rsync-auto grunt alternative.coffee
Last active March 25, 2020 04:45
Gruntfile to trigger new Vagrant 1.5 rsync command when catching changes. Faster than Vagrant rsync-auto bundled command, mainly because Grunt only watches specified paths while Guard/Listen (used internally by Vagrant) watches the whole (sub)-folders.
terminal = require('color-terminal')
log = (error, stdout, stderr, cb) ->
if error
terminal.color('red').write stdout
else
terminal.color('green').write stdout
cb()
@Nooshu
Nooshu / app.js
Last active May 28, 2021 00:01
Webmention code used in the "Implementing Webmentions on this blog" Nooshu blogpost
(function(){
// Check see if browser supports the intersection observer
if ('IntersectionObserver' in window) {
// assume browser supports ES6
var supportsES6 = true;
// check see if browser supports ES6 (https://gist.github.com/DaBs/89ccc2ffd1d435efdacff05248514f38)
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
@conorhastings
conorhastings / simple-redux.js
Last active June 11, 2021 01:36
A very (read: don't do this) simple implementation of redux
/*
* The reason for this is just a thought exercise
* often people(myself super included) are so confused
* when trying something new, but breaking it down
* to it's simplest existence can be the best way to understand
*/
function createStore(reducer, initState) {
let state = initState;
let subscribers = [];
@eduwass
eduwass / gulpfile.js
Created November 23, 2015 10:04
Gulp task to SSH into production server and retrieve mysqldump
////////////////////////////////////////////////////////////////////
// Run: 'gulp download-db' to get latest SQL dump from production //
// File will be put under the 'dumps' folder //
////////////////////////////////////////////////////////////////////
// Load stuff
'use strict'
var gulp = require('gulp')
var GulpSSH = require('gulp-ssh')
var fs = require('fs');
@siffring
siffring / .htaccess
Created March 4, 2012 17:33
htaccess to password protect a specific server
# ----------------------------------------------------------------------
# Password protect staging server
# Use one .htaccess file across multiple environments
# (e.g. local, dev, staging, production)
# but only password protect a specific environment.
# ----------------------------------------------------------------------
SetEnvIf Host staging.domain.com passreq
AuthType Basic
AuthName "Password Required"
@nuxlli
nuxlli / sublime_text_2_useful_shortcuts.md
Created September 9, 2011 18:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@adamgiese
adamgiese / nth-child-quantity-mixins.scss
Last active April 19, 2023 11:22
Advanced nth-child mixins
@mixin valid-quantity($quantity) {
@if type-of($quantity) != 'number' {
@error 'The "quantity" parameter must be a number!';
}
@if not(unitless($quantity)) {
@error 'The "quantity" parameter must not have a unit!';
}
@if $quantity < 0 {
@error 'The "quantity" parameter must be at least 0!';
}
@tkadlec
tkadlec / perf-diagnostics.css
Last active June 8, 2023 17:47
CSS used to highlight potential performance issues
:root {
--violation-color: red; /* used for clear issues */
--warning-color: orange; /* used for potential issues we should look into */
}
/* IMAGES */
/*
* Lazy-Loaded Images Check
* ====