Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Horn beije

View GitHub Profile
@beije
beije / Loading.js
Last active Oct 26, 2019
React-native loading component example for my blog post about react-native animations - https://benjaminhorn.io/code/different-ways-to-implement-a-circular-infinite-animation-in-react-native/
View Loading.js
import React from 'react';
import { Animated, Easing, Image, StyleSheet, View } from 'react-native';
const Loading = (props) => {
const iconAnimation = new Animated.Value(0);
// Loop the animation
Animated.loop(
Animated.sequence([
@beije
beije / settings.json
Last active Nov 9, 2015
Visual Studio Code Settings
View settings.json
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Courier New",
"editor.glyphMargin": true,
"editor.renderWhitespace": true,
"javascript.validate.lint.curlyBracketsMustNotBeOmitted": "warning",
"editor.tabSize": "4",
"editor.fontSize": 14,
"editor.insertSpaces": "true"
}
@beije
beije / gist:224cfb66c327f3e36f54
Last active Aug 29, 2015
Fibonacci with ES6 generators
View gist:224cfb66c327f3e36f54
function *fibonacci(numbers) {
var prevValue = 0;
var currentValue = 1;
var newValue = 0;
for(var i = 0; i < numbers; i++) {
newValue = currentValue+prevValue;
prevValue = currentValue;
currentValue = newValue;
yield currentValue;
@beije
beije / index.html
Created Feb 24, 2015
Vignetting an image in CSS
View index.html
<div class="image-container">
<img src="myimage.jpg" />
</div>
View InfiniteScroll.js
(function($, window, undefined) {
var InfiniteScroll = function() {
this.initialize = function() {
this.setupEvents();
};
this.setupEvents = function() {
$(window).on(
'scroll',
this.handleScroll.bind(this)
@beije
beije / devenv.conf
Created Apr 16, 2014
VirtualHost multiple dev environments
View devenv.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
VirtualDocumentRoot "/var/www/%0"
ServerName localhost
ServerAlias *
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@beije
beije / CameraRaw.php
Last active Nov 15, 2018
A small PHP class that can handle the extraction of preview files from a camera RAW file. Dependencies: imagemagick, ufraw and exiv2.
View CameraRaw.php
<?php
/**
* A class that can fetch preview images from camera raw files.
*
* In order to use this class you'll need a few php mods and
* some other software installed on your server.
*
* - imagemagick (Manage images)
* - ufraw (Reading and converting raw files)
@beije
beije / 10.0.0.10.conf
Last active Oct 23, 2019
An example apache virtual host config for internal proxying. A wonderous hack if you lack control of DNS servers and need to test a site on a device that doesn't let you modify the hosts file.
View 10.0.0.10.conf
<VirtualHost *:80>
ServerName 10.0.0.10
# Set url to proxy
ProxyPass / http://hosts.domain.dev/
ProxyPassReverse / http://hosts.domain.dev/
# Set location
<location />
# Set url
You can’t perform that action at this time.