Skip to content

Instantly share code, notes, and snippets.

@ahallora
ahallora / keybase.md
Created March 4, 2015 05:41
keybase.md

Keybase proof

I hereby claim:

  • I am ahallora on github.
  • I am aholm (https://keybase.io/aholm) on keybase.
  • I have a public key whose fingerprint is F66A D56D 665E 27CA 607B D762 FECA 5321 AC4F C509

To claim this, I am signing this object:

@ahallora
ahallora / executesql.js
Last active August 29, 2015 14:17
PDO with MS-SQL (Azure) and Node.js
// -------------------------------------------------------------------------
// USING MSSQL NPM AND PREPARED STATEMENTS IN NODE.JS
// ENABLING ? AS PLACEHOLDERS IN SQL AND AUTOMATIC TYPECASTING OF PARAMETERS
// THIS IS WORKING ON AZURE WITH NODE.JS AND MSSQL NODE MODULE - YAII :)
// -------------------------------------------------------------------------
// MIT LICENSE 2015 @ Anders Holm-Jensen
// -------------------------------------------------------------------------
var sql = require('mssql');
var config = {
@ahallora
ahallora / server.js
Last active November 18, 2015 09:43
Spotify Token Exchange (written in node.js)
// Node.js version of the Spotify Token Exchange originally scripted in ruby (based on beta 6 release candidate)
// https://github.com/spotify/ios-sdk/blob/master/Demo%20Projects/spotify_token_swap.rb
var express = require('express');
var bodyParser = require('body-parser');
var request = require('request');
var app = express();
var http = require('http').Server(app);
var config = {}
@ahallora
ahallora / Click Rate Limiter.html
Created February 16, 2016 10:19
A simple Click Rate Limiter / Debouncer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
</head>
<body>
<ul id="list"></ul>
<button id="thebutton">Try me</button>
@ahallora
ahallora / animation.html
Created October 30, 2016 19:59
PNG Sprite Animation with CSS
<style type="text/css">
.pngAnimation {
background: url(../assets/img/ourdio-sprite-png.png) no-repeat left top;
background-size: 2900%; /* 28+1 steps * 100% */
height: 50px;
width: 50px;
animation: o-burst 1000ms steps(28) infinite;
}
@ahallora
ahallora / test.html
Created November 4, 2016 12:24
Ractive test: Change object across "ractives"
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ractive/0.8.4/ractive.min.js" integrity="sha256-heXunjNkqBw9mc4urNeQE1t8qZRu4c8jSqjhE7c45BU=" crossorigin="anonymous"></script>
<h1>Ractive test</h1>
<div style="float: left; width: 50%; background-color: #eee;" id="placeholderOne"></div>
<div style="float: left; width: 50%; background-color: #ddd;" id="placeholderTwo"></div>
@ahallora
ahallora / input masking.html
Last active November 7, 2016 11:20
Input Masking
<!--
Author: Anders Holm-Jensen @ 7-NOV-2016
License: MIT
-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.js" integrity="sha256-5i/mQ300M779N2OVDrl16lbohwXNUdzL/R2aVUXyXWA=" crossorigin="anonymous"></script>
<h4>Input Masking</h4>
<input type="text" class="datamasked-input" data-maskgroup="partygroup" data-masklength="6" value="" onclick="alert('yes, we made it! Now join ' + this.value);" />
<script type="text/javascript">
@ahallora
ahallora / Horizontal scroller.html
Created November 15, 2016 11:02
Horizontal scrolling area (iOS inertia style) with just CSS
<!-- Source: https://benfrain.com/horizontal-scrolling-area-css-overflow-ios/ -->
<div class="outer">
<div class="wrapper">
<a href="" class="internal">item 1</a>
<a href="" class="internal">item 2</a>
<a href="" class="internal">item 3</a>
<a href="" class="internal">item 4</a>
<a href="" class="internal">item 5</a>
<a href="" class="internal">item 6</a>
@ahallora
ahallora / Rearranger.html
Last active November 16, 2016 07:06
Rearrange List with smooth-sliding animations
<h1>Rearrange List with smooth-sliding animations</h1>
<p>Click on the tiles to randomly make them move among each other with a smooth 3D-like effect. Transitions are hardware accelerated with CSS3 and accompanied with under the hood DOM-manipulation.</p>
<p>Author: Anders Holm-Jensen, allora.dk - License: MIT</p>
<ul id="list">
<li>Anders And</li>
<li>Andersine And</li>
<li>Joakim von And</li>
<li>Fætter Højben</li>
<li>Rip, rap og Rup</li>
</ul>
@ahallora
ahallora / Utility Functions.js
Created February 20, 2017 19:31
Various functions to check the integrity of data.
function isString(x) {
return x !== null && x !== undefined && x.constructor === String
}
function isNumber(x) {
return x !== null && x !== undefined && x.constructor === Number
}
function isBoolean(x) {
return x !== null && x !== undefined && x.constructor === Boolean