Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Stef van den Ham Hyra

🏠
Working from home
View GitHub Profile
@Hyra
Hyra / add-panresponder.js
Last active Feb 6, 2020
Getting started with the PanResponder in React Native
View add-panresponder.js
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 Apr 11, 2016
Geneate n amount of unique codes containing the characters you specify and write them to a file
View generate_codes.js
// 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";
View _stackoverflow.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:0cc9cf03ed9a4c366aa3
// TestController.js
module.exports = function (app) {
return function($scope) {
$scope.somevar = 'Whatever';
};
};
View Gruntfile.js
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 Mar 22, 2013
iOS orientationchange zoom bug fix
View gist:5220399
/*! 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);