Skip to content

Instantly share code, notes, and snippets.

@iamphill
iamphill / gradients
Created January 9, 2013 08:30
CSS Gradients, includes IE. For future reference when I need the IE filter, who can actually remember that?!
background:#ffffff;
background: -webkit-linear-gradient(top, #ecebeb 0%, #ffffff 50%, #ecebeb 100%);
background: -moz-linear-gradient(top, #ecebeb 0%, #ffffff 50%, #ecebeb 100%);
background: -o-linear-gradient(top, #ecebeb 0%, #ffffff 50%, #ecebeb 100%);
background: linear-gradient(top, #ecebeb 0%, #ffffff 50%, #ecebeb 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ecebeb');
@iamphill
iamphill / gist:5338003
Created April 8, 2013 16:06
Popup Present Model View
- (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view
{
if(SYSTEM_VERSION_LESS_THAN(@"6.0")) {
[modalViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:modalViewController animated:YES completion:nil];
} else {
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
UIGraphicsBeginImageContext(self.view.window.frame.size);
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()];
@iamphill
iamphill / snippet.cs
Last active December 23, 2015 06:29
Create a snippet of text with the specified length
public static string CreateSnippet(string s, int length)
{
if (String.IsNullOrEmpty(s))
{
return "";
}
const string Ellipsis = "...";
if (s.Length > length)
{
@iamphill
iamphill / inner.js
Created January 22, 2014 11:43
IE8 doesn't have window.innerWidth or window.innerHeight So here is two functions to help with that.
/**
* Get window width
**/
var getWindowWidth = function() {
return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
};
/**
* Get window height
**/
@iamphill
iamphill / file.cs
Created May 21, 2014 11:02
C# data URI
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Caching;
using System.IO;
using Umbraco.Core.Models;
using Umbraco.Core.Logging;
/// <summary>
@iamphill
iamphill / Gruntfile.js
Last active August 29, 2015 14:08
Grunt IIS kill on exit
module.exports = function (grunt) {
grunt.initConfig({
// Some other grunt tasks
iisexpress: {
server: {
options: {
path: require('path').resolve('.') + '/[PATH OF WEBSITE HERE]',
killOn: 'iis.kill'
}
}
@iamphill
iamphill / twitter.md
Last active August 29, 2015 14:08
Access Twitter timeline with JS

https://cdn.syndication.twimg.com/widgets/timelines/[WIDGET URL]?suppress_response_codes=true&callback=?

Create a Twitter embed widget and then take the ID number from URL and swap the [WIDGET URL] with this ID. Then just use as you wish to get access to the data. With jQuery I use..

$.getJSON('https://cdn.syndication.twimg.com/widgets/timelines/[WIDGET URL]?suppress_response_codes=true&callback=?', function (data) {
  var $html = $(d.body)
  // Do something with the return HTML
});
@iamphill
iamphill / Instagram.md
Last active August 29, 2015 14:10
Instagram shadow DOM

Instagram Shadow DOM

This creates a new element instagram-box element which displays 12 recent images with a specific tag.

Taken out of a project due to the polyfill failing in IE9. Works natively in Chrome, needs polyfilled for all other browsers.

@iamphill
iamphill / iphone.css
Created January 21, 2015 15:33
On iPhone, if input font size is below 16px it will automatically zoom in
input {
font-size: 16px;
}
@iamphill
iamphill / gulpfile.js
Last active August 29, 2015 14:15
First gulpfile ever made for some awesome-y projects
var gulp = require('gulp'),
sass = require('gulp-sass'),
watch = require('gulp-watch'),
to5 = require('gulp-6to5'),
browserify = require('gulp-browserify'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
runSequence = require('run-sequence');
gulp.task('watch', function () {