View Tabs2SpacesAndRemoveTrailingSpaces.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for file in split $(find -path "./*.js"); do | |
expand --tabs=2 $file | sed 's/[ \t]*$//' > "${file}_temp" | |
mv "${file}_temp" $file | |
rm "${file}_temp" | |
done |
View gist:2857792
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- phpMyAdmin SQL Dump | |
-- version 3.4.9 | |
-- http://www.phpmyadmin.net | |
-- | |
-- Host: localhost | |
-- Generation Time: Jun 02, 2012 at 11:56 AM | |
-- Server version: 5.5.9 | |
-- PHP Version: 5.3.6 | |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
View brunel-week.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var today = new Date() | |
var secondsInAWeek = 604800 | |
var startDate = new Date(2015, 8, 20) | |
var weekNo = Math.ceil((today - startDate) / (secondsInAWeek * 1000)) | |
console.log('Current Week Number: ' + weekNo) |
View license
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# Usage: license | |
# Prints an MIT license appropriate for totin' around. | |
# | |
# $ license > COPYING | |
#!/bin/sh | |
echo "Copyright (c) `date +%Y` Ben Evans | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the |
View backup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
backup_tables('MYSQL_HOST','MYSQL_USER','MYSQL_PASS','MYSQL_DB'); | |
/* backup the db OR just a table */ | |
function backup_tables($host,$user,$pass,$name,$tables = '*') | |
{ | |
$link = mysql_connect($host,$user,$pass); |
View dabblet.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript" src="http://stats.bensbit.co.uk/javascripts/bbar.js"></script> | |
<header> | |
<div class=container> | |
<h1>StatsBox</h1> | |
</div> | |
</header> | |
<div id="content" class=container> |
View gist:4036162
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# localisedEstimate: | |
# targetlngLat (Array|Object) = Containing the latLng you require a definition for | |
# Example: [9, 10] | |
# surroundinglngLats (Array) = Local LngLats (objects) to be used when finding the value of target. | |
# Example: [{lng:9.21, lat:10.23, value:34}, {lng:8.5, lat:9.78, value:10}] | |
# valueKey (String) = Key used for value in surroundinglngLats Objects. | |
# Example: 'NDWI' | |
localisedEstimate = (targetlngLat, surroundinglngLats, valueKey) -> |
View gist:4036327
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongoose = require 'mongoose' | |
db = mongoose.createConnection(config.mongo.host, config.mongo.db); | |
db.on 'error', console.error.bind(console, 'connection error:') | |
db.once 'open', () -> | |
console.log 'Connected to DB' | |
schemaFiles = fs.readdirSync './db/schemas' | |
for filename in schemaFiles |
View dabblet.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SoundForcast | |
*/ | |
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } | |
body { | |
background: linear-gradient(180deg, #111, #000); |
View gist:4117847
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bubbleSort (sortingArray) { | |
var goto = sortingArray.length - 1; | |
for(var key in sortingArray) { | |
for(var i = 0; i <= goto - 1; i++) { | |
if(sortingArray[i] > sortingArray[i + 1]) { | |
// Swap | |
var temp = sortingArray[i]; | |
sortingArray[i] = sortingArray[i +1]; | |
sortingArray[i + 1] = temp; | |
} |
OlderNewer