Skip to content

Instantly share code, notes, and snippets.

View robotnealan's full-sized avatar

Rob(ot) Nealan robotnealan

View GitHub Profile
@robotnealan
robotnealan / WaveformAnimated.js
Created August 26, 2018 18:55
An example React component on
import React, { Component } from 'react';
import { connect } from 'react-redux';
import _isEmpty from 'lodash/isEmpty';
import bowser from 'bowser';
const userAgent = bowser.detect(window.navigator.userAgent);
class WaveformAnimated extends Component {
constructor(props) {
super(props);
@robotnealan
robotnealan / default.conf
Last active May 23, 2018 20:53
Archived Version of Nginx Config for Ghost
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
location ~ ^/.well-known {
root /var/www/ghost;
}
location / {
return 301 https://$server_name$request_uri;
@robotnealan
robotnealan / sites-available-ghost-www
Created January 25, 2017 02:23
DigitalOcean LetsEncrypt Nginx Config: www. Edition
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
return 301 https://www.yourdomain.com$request_uri;
}
server {
listen 443 ssl;
server_name yourdomain.com;
return 301 $scheme://www.yourdomain.com$request_uri;
@robotnealan
robotnealan / whichAndroid.js
Created October 20, 2016 09:49
A simple function to check the version of Android devices.
// whichAndroid()
//
// Checks the userAgent to see if it's an Android device and returns the version
// number if true. Returns false on all other browsers/devices.
let whichAndroid = function() {
var userAgent = navigator.userAgent.toLowerCase();
var check = userAgent.match(/android\s([0-9\.]*)/);
return check ? check[1] : false;
};
@robotnealan
robotnealan / apacheCorsHeaders.conf
Last active October 20, 2016 09:45
An apache rule to set open CORS headers to a specific directory.
<Directory "/path/to/folder/containing/images">
# If you have specific sub-domains you can list them instead
# of using the '*' wildcard.
Header always set Access-Control-Allow-Origin "*"
</Directory>
@robotnealan
robotnealan / resizeCanvas.js
Created October 20, 2016 09:39
A function for resizing a canvas element to maintain its aspect ratio relative to an image drawn to it.
// resizeCanvas()
//
// Resizes the background canvas element to maintain img proportions
// while centering and stretching canvas to fill fullscreen.
let resizeCanvas = function(img_ratio) {
let window_w = window.innerWidth;
let window_h = window.innerHeight;
let window_ratio = window_w / window_h;
jasidfjiosadjfiodsjaiofsdjio iosaidf
a
sdf
sdf
dsa
fds
@robotnealan
robotnealan / blurBackground.js
Last active October 20, 2016 10:11
blurBackground Method Pulled from the Proton Marionette Application
Show.RadioView = Marionette.LayoutView.extend({
blurBackground: function() {
if(whichAndroid() > 4.4 || whichAndroid() === false) {
const img = new Image();
const canvas = document.getElementById('dataCanvas');
const radius = 50;
// Make it work with CORS
img.crossOrigin = '';
img.src = this.imageURL;
@robotnealan
robotnealan / sites-available-ghost
Last active March 20, 2019 09:33
DigitalOcean LetsEncrypt Nginx Config
server {
listen 80;
listen [::]:80;
server_name robertnealan.com;
root /var/www/ghost/system/nginx-root;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;