Skip to content

Instantly share code, notes, and snippets.

View m0ngr31's full-sized avatar
👍

Joe Ipson m0ngr31

👍
View GitHub Profile
import React, { Component } from 'react';
import { StyleSheet, Text, ScrollView, View, Dimensions } from 'react-native';
import AutoResponisve from 'autoresponsive-react-native';
const SCREEN_WIDTH = Dimensions.get('window').width;
/**
* we store all of our elements calculated heights in there
* @type {Array}
*/
@julianshapiro
julianshapiro / IE.js
Last active August 2, 2017 01:02
Future-Proof IE Version Detection Without User Agent Sniffing
var IE = (function() {
if (document.documentMode) {
return document.documentMode;
} else {
for (var i = 7; i > 4; i--) {
var div = document.createElement("div");
div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->";
if (div.getElementsByTagName("span").length) {
@yumitsu
yumitsu / gist:ec0c8f1f03dbc94eed8c
Created August 29, 2014 09:22
ST3 build 3065, Linux x64 - licenses

These licenses will be valid after sublime_text patching:

- BEGIN License -
Love
Unlimited user license
EA7E-8441
918381ACA844A0379CCAC729059720A4
BC9D409098618744BB45FF23E67568DB
82B926D92157127DB3B4054834D0477F
@awreese
awreese / useCancellableFetch.js
Last active October 5, 2022 23:35
Cancellable Fetch React Hook
import { useEffect } from "react";
/**
* Cancellable Fetch request decorator - Higher Order Function
* --
* Decorates a standard fetch request with an AbortController's signal
* included with the fetch options.
*
* Based, in part, upon Oleg Lytvyn's ["How you can abort Fetch() request on a flight…" article](https://itnext.io/how-you-can-abort-fetch-request-on-a-flight-830a639b9b92)
*
@belsrc
belsrc / gist:672b75d1f89a9a5c192c
Last active April 15, 2023 15:13
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@cspanring
cspanring / pip-install-gdal.md
Last active October 18, 2023 07:56
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment:

@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active February 21, 2024 03:02
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@fizzyade
fizzyade / nvidiaheadend.md
Last active February 27, 2024 22:43
tvheadend container + nvidia ffmpeg under Unraid

NVIDIA+TVHEADEND+UNRAID+ACCELERATED FFMPEG

I recently had a need to get hardware accelerated ffmpeg running on tvheaded under unraid, I eventually achieved this with a few tricks, here are my notes on what I did to achieve this.

First up, Unraid NVIDIA support

Install the Nvidia plugin under Unraid, this installs a custom kernel complete with the nidia drivers and docker runtime to support thiese.

Next install a hardware accelerated FFMPEG

@vlucas
vlucas / encryption.js
Last active April 2, 2024 14:26
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);