Skip to content

Instantly share code, notes, and snippets.

View Elbone's full-sized avatar

Niels Oeltjen Elbone

View GitHub Profile
@Elbone
Elbone / gist:e5b79f02d7e77851aca5
Created June 24, 2014 00:29
metaQuery custom prefix example
<!doctype html>
<html>
<!--
Thanks NASA. http://www.jpl.nasa.gov/spaceimages/details.php?id=PIA12765
-->
<head>
<meta name="breakpoint-prefix" content="@media-">
<meta name="breakpoint" content="phone" media="(max-width: 480px)">
<meta name="breakpoint" content="small-tablet" media="(min-width: 480px) and (max-width: 600px)">
<meta name="breakpoint" content="tablet" media="(min-width: 600px) and (max-width: 1024px)">
@Elbone
Elbone / gist:dcabe053bcdcdd3fcc9f
Last active August 29, 2015 14:04
List of JS / MVC/ Realtime / Event driven frameworks

Just documenting a list of contenders for upcoming app project

React

http://facebook.github.io/react/

  • Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it's easy to try it out on a small feature in an existing project.
  • React uses a virtual DOM diff implementation for ultra-high performance. It can also render on the server using Node.js — no heavy browser DOM required.
  • React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding.

Flight

http://flightjs.github.io

@Elbone
Elbone / gist:fba2d967969b78a3d13d
Last active August 29, 2015 14:04
Interrobang

Interrobang

The interrobang is a punctuation mark — a combination of the exclamation and question marks — that expresses a question spoken with surprise. The 9 artists in the show were asked to deliver pieces that are experimental or from the periphery of their practice. These works are the Interrobang in the artist’s practice. Artists: Laith McGregor, Hiroyasu Tsuri (TwoOne), Niels Oeltjen, Stabs, Fred Fowler, Stanislava Pinchuk (Miso), Mik Shida, Kenta (Senekt), and Luke Pither. Interrobang opens 18:00 August 7 at No Vacancy QV. Until August 17. www.no-vacancy.com.au

Instagram text

The interrobang is a punctuation mark — a combination of the exclamation and question marks — that expresses a question spoken with surprise. The 9 artists in the show were asked to deliver pieces that are experimental or from the periphery of their practice. These works are the Interrobang in the artist’s practice. Artists: @laithmcgregor @t_w_o_o_n_e @nielsoeltjen @stabstabs @fredfowler 
@Elbone
Elbone / gist:1bed3661e463f2e06d26
Created August 14, 2014 04:06
Touch or mouse?
// jQuery touch or pointer class for css
$(document).on('touchstart mouseenter mouseover', function (event) {
var touchOrPointer = 'touch'; // Default
var touchClass = 'now-touch';
var pointerClass = 'now-pointer'
if (event.type == 'touchstart') {
$('body').removeClass(pointerClass).addClass(touchClass);
touchOrPointer = 'touch';
}
else {
@Elbone
Elbone / gist:dc55aac4f1b4017cbb37
Last active August 29, 2015 14:05
Resources for Monash students

Share work for assessment

  • Share with niels @ niels oeltjen . com

Week 4

By 6PM today submit to me by email an iPad sized document pdf (can be portrait or landscape) containing:

Compulsory

  • A defined visual style in the form of sample layouts
  • The content of your publication (text, images, video, links, references)
@Elbone
Elbone / gist:6c0913124c6864937724
Last active August 29, 2015 14:05
Screen width MediaQueries in JS without a library
<!-- Adapted from http://seesparkbox.com/foundry/breakpoint_checking_in_javascript_with_css_user_values -->
<!doctype html>
<html>
<head>
<title>CSS Media Check</title>
<style type="text/css">
#mediaquery{
-webkit-transition: width .001s;
-moz-transition: width .001s;
-ms-transition: width .001s;
<!-- For http://codepen.io/Elbone/pen/fHCjs -->
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="128px" height="96px" viewBox="0 0 128 96" enable-background="new 0 0 128 96" xml:space="preserve">
<rect width="128" height="96"/>
<polygon fill="#FFFFFF" points="80,32.003 50,70 32,56 16,80 112,80 "/>
<circle fill="#FFFFFF" cx="28" cy="28" r="12"/>
<script>document.getElementsByTagName("rect")[0].setAttribute("fill", location.hash);</script>
</svg>
@Elbone
Elbone / gist:2b2a53526f33b5a1b952
Created November 3, 2014 01:04
How to write switch statements the right way in js
// NOT SWITCHES
function doSomething(condition) {
switch (condition) {
case 'one':
return 'one';
break;
case 'two':
return 'two';
break;
@Elbone
Elbone / gist:08f9ef409af076acb373
Last active August 17, 2017 00:13
Ha ha javascript (gotchas and quirks)
console.log(",,," == new Array(4)); // true // A string is an array
console.log([] + []); // "" // Array plus array = empty string (OF COURSE!)
// Array + object
console.log([] + {}); // [object Object]
// now flip it
console.log({} + []); // 0 // What the hell?!?
// Object + object
console.log({} + {}); // NaN // Noooooo
@Elbone
Elbone / gist:6e4e4a23b3dd1eabd025
Created January 29, 2015 03:49
Input to decimal number
inputToDecimalNumber: (Num, Dec) ->
return false if (typeof Num is 'function')
return false if (typeof Num is 'object')
return false if (typeof Num is 'boolean')
return false if (typeof Num is 'undefined')
Num = ''+ Num # Force into string
Num = Num.replace(/[^0-9\.]+/g, '') # Clean up
Num = parseFloat(Num) # Force back into number
Num = Math.round(Num*Math.pow(10,Dec))/Math.pow(10,Dec)
Num = (Num).toFixed(Dec)