Skip to content

Instantly share code, notes, and snippets.

View kevinsimper's full-sized avatar

Kevin Simper kevinsimper

View GitHub Profile
@kevinsimper
kevinsimper / tooltip.css
Created December 12, 2012 11:35
Tooltip CSS A CSS3 snippet, which uses the Before and Hover statements.
/* Wrap around a div about what you will in a tooltip and it will hide the content and show only a symbol */
.tooltip:before {
content: url(/media/icon16_tooltip.png);
margin-top: 18px;
}
.tooltip:hover:before {
content: '';
}
.tooltip {
vertical-align: top;
@kevinsimper
kevinsimper / gist:5142464
Created March 12, 2013 12:18
Function for adding messages to Iron.io MQ
var request = require('request');
function Queue(token, projectId, queue){
this.options = {
url: 'http://mq-aws-us-east-1.iron.io/1/projects/' + projectId + '/queues/' + queue + '/messages',
headers: {
'Content-Type': 'application/json',
'Authorization': 'OAuth ' + token
},
body: '{"messages":[{"body":"hello world!"}]}'
}
@kevinsimper
kevinsimper / last-four-quaters.js
Created June 27, 2013 12:42
Get the lastest 4 quaters in javascript. You could push the result into an array to use it in your script.
var currentQuater = parseInt(new Date().getMonth() / 3 + 1, 0);
// Quater has to finished
var firstQuater = currentQuater - 1;
// Get current year to know when we get before January.
var firstYear = new Date().getFullYear();
for (var i = 0; i < 4; i++) {
// If quater is equal to zero, go back a year
if (firstQuater === 0) {
firstQuater = 4;
@kevinsimper
kevinsimper / last-for-quaters-result
Created June 27, 2013 12:48
The Quater dates you will get in JavaScript
1 2013 Tue Jan 01 2013 00:00:00 GMT+0100 (CET) Sun Mar 31 2013 00:00:00 GMT+0100 (CET)
4 2012 Mon Oct 01 2012 00:00:00 GMT+0200 (CEST) Mon Dec 31 2012 00:00:00 GMT+0100 (CET)
3 2012 Sun Jul 01 2012 00:00:00 GMT+0200 (CEST) Sun Sep 30 2012 00:00:00 GMT+0200 (CEST)
2 2012 Sun Apr 01 2012 00:00:00 GMT+0200 (CEST) Sat Jun 30 2012 00:00:00 GMT+0200 (CEST)
@kevinsimper
kevinsimper / z-index_old_browser.html
Last active December 19, 2015 13:59
Z-index in old browsere
<!-- DOES NOT WORK -->
<div>
<div id="graph" style="z-index: 10"></div>
<div id="options">
<div id="popup" style="z-index: 20"></div>
</div>
</div>
<!-- DOES WORK -->
<div>
@kevinsimper
kevinsimper / crawler.js
Created August 29, 2013 14:21
Crawler fix
$(this).find('.icons').find('.variable').length === 1
@kevinsimper
kevinsimper / angular.jekyll.js
Created August 30, 2013 08:07
This solves the problem with using Angular.js and Jekyll
var app = angular.module('app', []).config(function ($interpolateProvider) {
$interpolateProvider.startSymbol('{[{').endSymbol('}]}');
});
@kevinsimper
kevinsimper / npm-debug.log
Created January 22, 2014 14:55
Trying to install express directly but it fails
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'visionmedia/express' ]
2 info using npm@1.3.24
3 info using node@v0.10.24
4 verbose cache add [ 'visionmedia/express', null ]
5 verbose cache add name=undefined spec="visionmedia/express" args=["visionmedia/express",null]
6 verbose parsed url { protocol: null,
6 verbose parsed url slashes: null,
6 verbose parsed url auth: null,
6 verbose parsed url host: null,
@kevinsimper
kevinsimper / jquery-ui-datepicker-dansk.js
Created January 24, 2014 03:15
jQuery UI datepicker oversat til dansk så den er lige til at copy paste, hvis du ikke lige selv vil bruge tid på at oversætte det som skal bruges.
$( ".selector" ).datepicker({
dayNamesMin: [ "Sø", "Ma", "Ti", "On", "To", "Fr", "Lø" ],
monthNames: [ "Januar", "Februar", "Marts", "April", "Maj", "Juni", "Juli", "August", "September", "Oktober", "November", "December" ],
firstDay: 1,
weekHeader: "Uge",
showWeek: true
});
@kevinsimper
kevinsimper / docs.json
Created February 5, 2014 20:57
Crafty new docs file
{
"core.js": [
{
"name": "Crafty",
"category": "Core",
"doc": [
"Select a set of or single entities by components or an entity's ID.",
"Crafty uses syntax similar to jQuery by having a selector engine to select entities by their components.",
"If there is more than one match, the return value is an Array-like object listing the ID numbers of each matching entity. If there is exactly one match, the entity itself is returned. If you're not sure how many matches to expect, check the number of matches via Crafty(...).length. Alternatively, use Crafty(...).each(...), which works in all cases."
],