Skip to content

Instantly share code, notes, and snippets.

View ryanlewis's full-sized avatar

Ryan Lewis ryanlewis

  • Leeds, United Kingdom
  • 03:53 (UTC +01:00)
View GitHub Profile
JSON.stringify = JSON.stringify || function (obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string") obj = '"'+obj+'"';
return String(obj);
}
else {
// recurse array or object
var n, v, json = [], arr = (obj && obj.constructor == Array);
@ryanlewis
ryanlewis / Program.cs
Created July 29, 2013 23:00
LinqToTwitter example to fetch tweet data for a particular tweet
using System;
using System.Linq;
using System.Text.RegularExpressions;
using LinqToTwitter;
namespace TweetTest
{
internal class Program
{
private static readonly Regex TweetStatusRegex = new Regex(@"^https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)$");
@ryanlewis
ryanlewis / gist:6112001
Last active December 20, 2015 09:59
Get difference between two commits. Powershell snippet to filter out a list of changed files by extension from git diff --stat
git diff 1.0.2 HEAD --stat=200
git diff 1.0.2 HEAD --stat=500 | where {$_ -Match ".cshtml|.css"} | %{$line=$_.split(" "); write-host $line[1] }
git diff 1.0.2 HEAD --stat=200 | where {$_ -Match ".cshtml|.cs"} | %{$l=$_.split(" "); $file=$l[1]; $file=$file.replace("Umbraco.Site", ""); write-host $file }
@ryanlewis
ryanlewis / Pager.cshtml
Created August 27, 2013 16:41
A Razor/ASP.NET MVC pager that is adaptable for any project (Developed for Umbraco)
@model Epiphany.Web.Models.PagerViewModel
@{
var showPages = 5;
var maxPage = (int) Math.Ceiling((decimal) Model.Total/Model.PageSize);
}
@*[[ PAGER PAGE:@Model.Page PAGESIZE:@Model.PageSize TOTAL:@Model.Total MAXPAGE:@maxPage ]]*@
<div class="pagination">
@ryanlewis
ryanlewis / twitter-responsive.css
Created October 15, 2013 20:41
User style for twitter.com to make the main desktop design responsive
@media screen and (max-width:840px) {
.wrapper {
width: 100%;
padding-left: 0;
padding-right: 0;
background: none !important;
}
.dashboard, .content-main {
width: auto ;
@ryanlewis
ryanlewis / cleanImageGenCache.js
Last active December 28, 2015 10:29
Remove all the ImageGen cache files and directories from a root media folder. npm install underscore q optimist OR npm install underscore q optimist -g
#!/usr/bin/env node
var _ = require('underscore');
var fs = require('fs');
var Q = require('q');
var argv = require('optimist')
.usage('Usage: $0 -base [directory')
.demand(['base'])
.describe('base', 'Media directory')
.argv;
  1. Drain the meat from the brine.
  2. Pat dry with kitchen towel
  3. Mix approx 2-3 table spoons of salt, pepper, garlic powder and oil in a dish
  4. Rub the salt-oil mixture over the meat, ensuring you get it into the slits of the top layer of fat.
  5. Place on the roasting tray (where the bacon goes) with the grill in.
  6. Cover with foil to form a seal over the top.
  7. Roast for 5 to 6 hours
  8. 30 minutes before about to pull out of the oven, take off the foil
  9. Allow to rest for 20-30 minutes before serving
@ryanlewis
ryanlewis / SassMeister-input.scss
Created April 23, 2014 20:28
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
@mixin image2x-retina($file, $type, $width, $height, $mod: '@2x') {
$fileName: $file + '.' + $type;
$retina: $file + $mod + '.' + $type;
background-image: url($fileName);
@ryanlewis
ryanlewis / CleanASPNETCrap.ps1
Created April 28, 2014 09:17
Clean out your ASP.NET Temporary files
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
Get-ChildItem "C:\Windows\Microsoft.NET\Framework*\v*\Temporary ASP.NET Files" -Recurse | Remove-Item -Recurse
@ryanlewis
ryanlewis / google_twunter_lol
Created May 27, 2014 14:28 — forked from jamiew/google_twunter_lol
Naughty word list, compiled by Google and @jamiew
4r5e
5h1t
5hit
a55
anal
anus
ar5e
arrse
arse
ass