Skip to content

Instantly share code, notes, and snippets.

@rutger1140
rutger1140 / .htaccess
Created February 17, 2014 13:10
Protect WordPress login's from unauthorized IP's
# Protect wp-login
<Files wp-login.php>
order deny,allow
deny from all
# Localhost
allow from ::1
allow from 192.168.
# IP from users
@rutger1140
rutger1140 / Gruntfile.js
Last active August 29, 2015 13:56
Grunt and bower build scripts for frontend stack of website
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.name %> | <%= pkg.author %> | <%= grunt.template.today("yyyy-mm-dd") %> */\n',
usebanner: {
build: {
options: {
@rutger1140
rutger1140 / gist:9249067
Created February 27, 2014 12:22
IP range notation
11.11.11.11/32 <- just the host 11.11.11.11
11.11.11.0/24 <- the whole 11.11.11.0 network (254 ips)
11.11.0.0/16 <- the 11.11.0.0 network (64k ips)
11.0.0.0/8 <- the 11.0.0.0 network (16million ips)
@rutger1140
rutger1140 / simplecache.php
Created March 13, 2014 18:38
Very basic caching script for PHP
<?php
// Example usage
// Set source location
$sourcepath = "http://mysite.com/api/call/something";
// Set cache file
$cacheName = "apicall.cache";
@rutger1140
rutger1140 / grid.html
Last active August 29, 2015 13:57
Generate masonry grid blocks with LESS mixin
<!-- Sample HTML -->
<div class="grid">
<div class="grid__item grid-w1 grid-h1"></div>
<div class="grid__item grid-w1 grid-h2"></div>
<div class="grid__item grid-w2 grid-h2"></div>
<div class="grid__item grid-w4 grid-h3"></div>
</div>
@rutger1140
rutger1140 / gist:9993776
Created April 5, 2014 16:05
Check for JS and SVG support and add/remove HTML classes accordingly. Snippet used in <head>
<script>
// Check for javascript support
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement);
// Check for SVG support
(function(H){if(!!("createElementNS"in document&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)){H.className+=" svg"}else{H.className+=" no-svg"}})(document.documentElement);
</script>
#!/usr/bin/env bash
# Use with bash 4.0+
#==========================================================================================
# Original Script from Clemens Lang, neverpanic.de
# https://neverpanic.de/blog/2014/03/19/downloading-google-web-fonts-for-local-hosting/
# Modified by Chris Jung, campino2k.de
# * Rename Files to be compatible with Windows File System (remove spaces and colon)
# * Add "local()" to src like Google does to skip downloading if System has font installed
@rutger1140
rutger1140 / cm-get-totals.php
Created June 4, 2014 10:00
Campaign Monitor - get campaign recipient totals
<!doctype html>
<html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Campaign Monitor - get campaign recipient totals</title>
<meta name="viewport" content="width=device-width">
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<body>
html {
position: relative;
min-height: 100%;
}
body {
margin: 0 0 100px; /* bottom = footer height */
}
footer {
position: absolute;
left: 0;
@rutger1140
rutger1140 / gist:cfc20db7e14e2863fb99
Created July 2, 2014 09:04
jQuery validation tests
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Validation plugin tests</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.min.css">
</head>
<body>
<form id="myform">