Skip to content

Instantly share code, notes, and snippets.

@iamphill
iamphill / index.html
Last active October 20, 2015 15:32
Trello shadow DOM
<style>
trello-board {
display: block;
height: 100%;
}
</style>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars.min-latest.js"></script>
<script id="trello-board" type="text/x-handlebars-template">
<style>
trello-list {
@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 / RegexHandler.go
Last active May 9, 2022 02:12
Very basic golang HTTP server
package main
import (
"net/http"
"Regexp"
)
type route struct {
pattern *regexp.Regexp
handler http.Handler