Skip to content

Instantly share code, notes, and snippets.

View mortenjust's full-sized avatar

Morten Just mortenjust

View GitHub Profile
@mortenjust
mortenjust / style.css
Created March 17, 2012 23:32
Text shadow with no direction
text-shadow: 0 0 2px black;
@mortenjust
mortenjust / index.html
Created March 17, 2012 23:38
HTML: Include JQuery
<script src="jquery-1.7.1.js" type="text/javascript" charset="utf-8"></script>
@mortenjust
mortenjust / gist:2066680
Created March 17, 2012 23:46
css: reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@mortenjust
mortenjust / gist:2066741
Created March 17, 2012 23:53
javascript: round to nearest x
function round5(x) { return (x % 5) >= 2.5 ? parseInt(x / 5) * 5 + 5 : parseInt(x / 5) * 5; }
@mortenjust
mortenjust / scrape.js
Created March 17, 2012 23:57 — forked from torgeir/scrape.js
Scraping with jsdom and jquery
/*
https://github.com/tmpvar/jsdom/tree/master/lib
$ curl http://www.timeanddate.com/norsk/kalender.html
(...)
<div id=po1 class=po></div>
<h1>Kalender for &#229;r 2011</h1>
<table class="ct" border="0" cellpadding="4" cellspacing="0" align="center">
(...)
$ node scrape.js
@mortenjust
mortenjust / gist:2066855
Created March 18, 2012 00:07
html: basic blank template
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Title</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
@mortenjust
mortenjust / gist:2067068
Created March 18, 2012 00:36
javascript jquery: document ready
$(document).ready(function() {
}
@mortenjust
mortenjust / gist:2067237
Created March 18, 2012 00:55
javascript jquery jsonp ajax
$.ajax({
url: url,
dataType: 'jsonp',
data: data,
success: callback
});
@mortenjust
mortenjust / proxy.php
Created March 18, 2012 12:57 — forked from therealklanni/proxy.php
Stupidly simple PHP proxy
<?php
// Stupidly simple PHP proxy for AJAX (HTTP GET) requests. Written by Kevin Lanni.
$dest = ''; // Set to the remote script URL (i.e. http://remotehost.com/some.php)
$a = array();
foreach ($_GET as $k=>$v) {
$a[] = "{$k}={$v}";
}
@mortenjust
mortenjust / gist:2072514
Created March 18, 2012 13:34
mysql date
$mysqldate = date( 'Y-m-d H:i:s', strtotime($Date));