Skip to content

Instantly share code, notes, and snippets.

View supasympa's full-sized avatar
🎧
💻⌨️🖥 @barclaytweets

Lewis Barclay supasympa

🎧
💻⌨️🖥 @barclaytweets
  • Supa Sympa Ltd
  • London
View GitHub Profile
@supasympa
supasympa / flexi-grid.less
Created March 25, 2013 21:49
LESS to create the classes required for creating a flexi grid.
@fixedCols :5;
@fixedRows :2;
.boxXxn(@X:5, @Y:2){
//iterate from 5 down to 0 X
.boxXY(@indexX, @indexY) when (@indexX > 0) and (@indexY > 0){
.box@{indexX}x@{indexY}{
width:((100 / @fixedCols) * @indexX) * 1%;
height:((100/ @fixedRows) * @indexY) * 1%;
@supasympa
supasympa / ssh-config-shortcut
Created June 20, 2012 04:44
Adding a shortcut to ssh
Host gh
Hostname github.com
User git
IdentityFile ~/.ssh/somekey
@supasympa
supasympa / updateShareThisButtons.js
Created December 5, 2011 14:54
Some code to update ShareThis buttons with custom images - useful in SPAs or AJAX apps
function updateShareButtons(location, title, imgsrc) {
$('.share').hide();
$('.sharethis').html('');
var services = [
{type : 'facebook',
image : './css/img/social-facebook.png'},
{type : 'twitter',
image : './css/img/social-twitter.png'},
{type : 'email',
@supasympa
supasympa / prototypalInheritance.js
Created July 14, 2011 14:36
My example of prototypal inheritance in Javascript for when I forget!
/*
An example of prototypal inheritance in Javascript for when I forget!
*/
console.log('> inheritance.js');
function main(){
console.log('start main.');
@supasympa
supasympa / localeNumberFormat.js
Created July 11, 2011 10:15
Javascript Locale Currency format
function localeNumberFormat(amount, currencySymbol, delimiter, decimalPlaces) {
// setup some default values
if (typeof decimalPlaces === 'undefined' || decimalPlaces === null) {
decimalPlaces = 0;
}
if (typeof decimalPlaces === 'undefined' || delimiter === null) { delimiter = ','; }
//check that the value can be recognised as an Floating point number
try {
amount = parseFloat(amount);
@supasympa
supasympa / propertyInspector.cs
Created April 21, 2011 16:32
Inspect the properties of an object and return the properties and the value followed by a line break (one level deep).
public static string Properties(object o, Type type, string linebreak)
{
StringBuilder sb = new StringBuilder();
foreach (var prop in type.GetProperties())
{
if (prop.CanRead)
{
var value = prop.GetValue(o, null);
if (value != null)