Skip to content

Instantly share code, notes, and snippets.

View Ultrabenosaurus's full-sized avatar

Dan Bennett Ultrabenosaurus

  • UK
View GitHub Profile
jTypes('struct Color', function(red, green, blue)
{
this.red = red;
this.green = green;
this.blue = blue;
},
{
'public int red': 0,
'public int green': 0,
'public int blue': 0
@chrisjlee
chrisjlee / querySelector.polyfill.js
Created February 12, 2014 17:39
IE document.querySelector() polyfill
if (!document.querySelectorAll) {
document.querySelectorAll = function (selectors) {
var style = document.createElement('style'), elements = [], element;
document.documentElement.firstChild.appendChild(style);
document._qsa = [];
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}';
window.scrollBy(0, 0);
style.parentNode.removeChild(style);
@ejdyksen
ejdyksen / mini-console.html
Last active September 18, 2017 22:13
A tool for getting at a JS console when there is none available.
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {
@evantravers
evantravers / README.md
Last active December 14, 2015 16:49
This is a bit from a mobile menu css file… it's inside a mediaquery for iphone. Makes the menu icon "hamburger" thing and animates it in pure css.

This css makes this:

desktop

Look like this:

mobile

@remy
remy / weekend-commits.js
Last active January 14, 2020 08:09
Run this in the console of your github.com/<user> page (i.e. http://github.com/remy) and see how many weekends you were in front of a computer and committing code instead of taking a break.
$.getJSON('https://github.com/users/' + location.pathname.replace(/\//g, '') + '/contributions_calendar_data', weekendWork);
function weekendWork(contribs) {
var inwe = false, streak = 0, highest = 0, total = 0, possible = 0;
contribs.forEach(function (c) {
var d = new Date(c[0]).getDay();
if (d === 6) {
inwe = true;
} else if (d === 0 && inwe) {
possible++;
if (c[1] !== 0) {
@xeoncross
xeoncross / top-cms-projects
Created November 5, 2012 03:04 — forked from abpin/top-cms-projects
List of top 1200 CMS systems
1. Joomla!
2. Drupal
3. Mambo
4. TYPO3 Enterprise CMS
5. WebGUI
6. WordPress
7. Plone
8. Xoops
9. PHP Nuke
10. eZ Publish
@xeoncross
xeoncross / anova_data.txt
Created October 16, 2012 16:38
Al-Kashi - statistics classes
model mpg cyl! disp hp drat wt qsec vs am! gear! carb!
Mazda RX4 21 6 160 110 3.9 2.62 16.46 0 1 4 4
Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.32 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.44 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.46 20.22 1 0 3 1
Duster 360 14.3 8 360 245 3.21 3.57 15.84 0 0 3 4
Merc 240D 24.4 4 146.7 62 3.69 3.19 20 1 0 4 2
Merc 230 22.8 4 140.8 95 3.92 3.15 22.9 1 0 4 2
@glucoz
glucoz / meta-tags.md
Created October 5, 2012 14:41 — forked from kevinSuttle/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
anonymous
anonymous / dabblet.css
Created September 27, 2012 13:42
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
@hparadiz
hparadiz / Devise.sha1.php
Created September 24, 2012 14:42
PHP Version of devise/lib/devise/encryptors/restful_authentication_sha1.rb for Older Versions of Devise
define('_DIGEST_PEPPER','PEPPER HERE');
function digest($password, $stretches, $salt, $pepper)
{
$digest = $pepper;
$x = 0;
while($x != $stretches)
{
$data = array($digest,$salt,$password,$pepper);