Skip to content

Instantly share code, notes, and snippets.

Avatar
🦜
Focusing

Simon sp90

🦜
Focusing
View GitHub Profile
View designer.html
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
View swipeFunc.js
var swipeFunc = {
touches : {
"touchstart": {"x":-1, "y":-1},
"touchmove" : {"x":-1, "y":-1},
"touchend" : false,
"direction" : "undetermined"
},
touchHandler: function(event) {
var touch;
if (typeof event !== 'undefined'){
View angular-autoNumeric.js
(function() {
'use strict';
/**
* # numeric[module]
*/
/**
*
* # Dependent
View fizzbuzz.js
for (var i = 1; i < 101; i++) {
var buzz = (i % 5 == 0) ? 'Buzz' : i;
var fizz = (i % 3 == 0) ? 'Fizz' : buzz;
var fizzBuzz = (i % 3 == 0 && i % 5 == 0) ? 'FizzBuzz' : fizz;
console.log("fizzBuzz: ", fizzBuzz);
}
View GetScrolledPos
function getScrollPosition() {
var last_known_scroll_position = 0;
var ticking = false;
var bodyEl = document.body;
var htmlEl = document.documentElement;
var height = Math.max(bodyEl.scrollHeight, bodyEl.offsetHeight,
htmlEl.clientHeight, htmlEl.scrollHeight, htmlEl.offsetHeight);
window.addEventListener('scroll', function(e) {
last_known_scroll_position = window.scrollY;
@sp90
sp90 / locationImage.js
Created May 26, 2016
Just a solution to google street view no imagry, needs some rewriting but it work
View locationImage.js
angular
.module('bolighed')
.directive('locationImage', LocationImage);
function LocationImage($q, $sce, $window, streetviewService) {
var apiKey = window.bolighed.google_api_key;
var staticMapApiEndPoint = 'https://maps.googleapis.com/maps/api/staticmap';
var streetviewApiEndPoint = 'https://maps.googleapis.com/maps/api/streetview';
@sp90
sp90 / Horizon angular 1.x
Last active Sep 7, 2016
A small helper to hook up to horizon
View Horizon angular 1.x
(function() {
'use strict';
angular.module('myApp')
.factory('horizon', horizonFactory);
function horizonFactory() {
var horizon = Horizon({
host: 'localhost:8181',
secure: true,
View Email regex
/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i
View ng-cookie-helper.js
@sp90
sp90 / app.js
Created Sep 27, 2016
Static site generator
View app.js
// Native modules
var path = require('path');
var fs = require('fs');
// Third party modules
var _ = require('lodash');
var config = {
numberOfPosts: 10000,
template: function(name) {
You can’t perform that action at this time.