Skip to content

Instantly share code, notes, and snippets.

@beije
beije / 10.0.0.10.conf
Last active February 26, 2021 18:58
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.
<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
@beije
beije / CameraRaw.php
Last active November 15, 2018 21:32
A small PHP class that can handle the extraction of preview files from a camera RAW file. Dependencies: imagemagick, ufraw and exiv2.
<?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 / devenv.conf
Created April 16, 2014 07:57
VirtualHost multiple dev environments
<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
(function($, window, undefined) {
var InfiniteScroll = function() {
this.initialize = function() {
this.setupEvents();
};
this.setupEvents = function() {
$(window).on(
'scroll',
this.handleScroll.bind(this)
@beije
beije / index.html
Created February 24, 2015 15:48
Vignetting an image in CSS
<div class="image-container">
<img src="myimage.jpg" />
</div>
@beije
beije / gist:224cfb66c327f3e36f54
Last active August 29, 2015 14:21
Fibonacci with ES6 generators
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 / settings.json
Last active November 9, 2015 20:40
Visual Studio Code Settings
// 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 / Loading.js
Last active October 26, 2019 15:05
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/
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([