Skip to content

Instantly share code, notes, and snippets.

View mikestreety's full-sized avatar

Mike Street mikestreety

View GitHub Profile
@mikestreety
mikestreety / HTML Template
Created January 22, 2012 16:58
A simple HTML Template to get you started
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!--[if lt IE 9]>
@mikestreety
mikestreety / Redirect to central domain
Created January 23, 2012 13:23
With htaccess, redirect to one cnetral domain for SEO and ux reasons
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !=www.codehorse.co.uk
RewriteRule ^(.*)$ http://www.codehorse.co.uk/$1 [L,R=301]
</IfModule>
@mikestreety
mikestreety / console.log
Created April 24, 2012 16:05
Console log - saves typing and such
function log(logstring) {
console.log(logstring);
}
@mikestreety
mikestreety / Insert less
Created May 18, 2012 16:08
Insert a less file with less added
<link rel="stylesheet/less" type="text/css" href="/css/styles.less">
<script src="/js/less.js" type="text/javascript"></script>
@mikestreety
mikestreety / gist:6053898
Created July 22, 2013 13:42
Adds an extra key/value pair to a json file
<?php
// This takes a get of location and postcode to put into a json file for use with https://github.com/MrQwest/activity
/* Example use:
$.ajax({
url: 'file.php',
type: 'GET',
data: {
location: [LOCATION - VARIABLE OR STRING],
@mikestreety
mikestreety / watch.sh
Created December 6, 2013 18:53
Using inotify to detect changes in a file. This case is used for less files to compile them
if which inotifywait >/dev/null; then # Checks to see if inotify tools exists
folder=`pwd`; # This is where it searches - pwd will run that command and run the rest based on your current folder
while true;
do
N=`find $folder -name "*.less"`; # Currently searches for all .less files in the folder above using a standard find command
if [[ -z $N ]]; then # If there is nothing found then it exits
echo There are no LESS files to be found - maybe cd to where there is some.
exit;
else
fileout=`inotifywait -qe modify $N`; # Gets the name of the file that was modified
@mikestreety
mikestreety / gist:8025134
Created December 18, 2013 16:20
List all the items in a dir
<?php
$dir = dirname(__FILE__); // Sets the dir you want to show images for
foreach(scandir($dir) as $item) : // for every item in the folder
if($item == '.') continue; // If it equals to any of these, don't show them
if($item == '..') continue;
if($item == 'index.php') continue; ?>
<?=$item?> <!-- echo the path -->
<?php endforeach; ?>
@mikestreety
mikestreety / SassMeister-input.scss
Created January 6, 2014 10:09
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@mixin font-face($font-name, $file, $svg-font-name: false, $weight: 100, $style: normal) {
@font-face {
$fonts: url('#{$file}.eot?#iefix') format('embedded-opentype'), url('#{$file}.woff') format('woff'), url('#{$file}.ttf') format('truetype');
@if($svg-font-name) {
@mikestreety
mikestreety / input.scss
Last active January 2, 2016 09:09
An unnecessarily complex font face dec
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@mixin font-face($font-name, $file, $svg-font-name: false, $weight: 100, $style: normal) {
@font-face {
$font-src: false;
$font-list: (
'eot?#iefix' 'embedded-opentype',
@mikestreety
mikestreety / SassMeister-input.scss
Created January 7, 2014 17:33
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
.box {
background: red;
.heading {
font-size: 20px;
}