Skip to content

Instantly share code, notes, and snippets.

View Hyra's full-sized avatar
🏠
Working from home

Stef van den Ham Hyra

🏠
Working from home
View GitHub Profile
@Hyra
Hyra / add-panresponder.js
Last active February 6, 2020 19:10
Getting started with the PanResponder in React Native
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
Image, // we want to use an image
PanResponder, // we want to bring in the PanResponder system
Animated // we wil be using animated value
} from 'react-native';
@Hyra
Hyra / generate_codes.js
Last active April 11, 2016 07:42
Geneate n amount of unique codes containing the characters you specify and write them to a file
// Generate X unique codes and write them to a file
// npm install crypto
// node generate_codes.js
var crypto = require('crypto');
var fs = require('fs');
function random (howMany, chars) {
chars = chars || "ACDEFGHJKMNPQRTWXYZ234679";
@Hyra
Hyra / _stackoverflow.svg
Last active August 29, 2015 14:15
SVG Sample
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// TestController.js
module.exports = function (app) {
return function($scope) {
$scope.somevar = 'Whatever';
};
};
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-dustjs');
@Hyra
Hyra / gist:5220399
Created March 22, 2013 10:39
iOS orientationchange zoom bug fix
/*! A fix for the iOS orientationchange zoom bug. Script by @scottjehl, rebound by @wilto.MIT / GPLv2 License.*/(function(a){function m(){d.setAttribute("content",g),h=!0}function n(){d.setAttribute("content",f),h=!1}function o(b){l=b.accelerationIncludingGravity,i=Math.abs(l.x),j=Math.abs(l.y),k=Math.abs(l.z),(!a.orientation||a.orientation===180)&&(i>7||(k>6&&j<8||k<8&&j>6)&&i>5)?h&&n():h||m()}var b=navigator.userAgent;if(!(/iPhone|iPad|iPod/.test(navigator.platform)&&/OS [1-5]_[0-9_]* like Mac OS X/i.test(b)&&b.indexOf("AppleWebKit")>-1))return;var c=a.document;if(!c.querySelector)return;var d=c.querySelector("meta[name=viewport]"),e=d&&d.getAttribute("content"),f=e+",maximum-scale=1",g=e+",maximum-scale=10",h=!0,i,j,k,l;if(!d)return;a.addEventListener("orientationchange",m,!1),a.addEventListener("devicemotion",o,!1)})(this);