Skip to content

Instantly share code, notes, and snippets.

View krazyjakee's full-sized avatar

Jake Cattrall krazyjakee

  • Twitch
  • UK
View GitHub Profile
@krazyjakee
krazyjakee / Distance Calculator
Created June 20, 2013 16:21
Function to return the distance between 2 points
distance = ( p1, p2 ) ->
x = p2.x - p1.x
y = p2.y - p1.y
return Math.sqrt x*x + y*y
/* line 1, ../threecss.sass */
tile {
width: 32px;
height: 32px;
background-color: "#00ff00";
left: 20px;
top: 50px;
}
/* line 5, ../threecss.sass */
@krazyjakee
krazyjakee / gist:dea9639309a2ff5f5773b568130af115
Created November 22, 2016 16:24
Detect GPU in javascript
var graphics_card = function(){
var gl = document.createElement("canvas").getContext("experimental-webgl");
return gl.getParameter(gl.getExtension("WEBGL_debug_renderer_info").UNMASKED_RENDERER_WEBGL);
}
document.body.innerHTML = graphics_card();
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.XMPP=e()}}(function(){var e;return function e(t,n,r){function s(o,i){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[o]={exports:{}};t[o][0].call(u.exports,function(e){var n=t[o][1][e];return s(n?n:e)},u,u.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({"/stanza.io-8.0.2/index.js":[function(e,t,n){"use strict";n.VERSION="8.0.2",n.JID=e("xmpp-jid").JID,n.Client=e("./lib/client"),n.createClient=function(t){var r=new n.Client(t);return r.use(e("./lib/plugins")),r}},{"./lib/client":"/stanza.io-8.0.2/lib/client.js","./lib/plugins":"/stanza
@krazyjakee
krazyjakee / Dockerfile
Last active July 24, 2020 00:59
Razzle Docker Container
FROM node:alpine
ENV NODE_ENV production
ENV HOST 0.0.0.0
ENV PORT 80
ENV RAZZLE_CUSTOM_VARIABLE x
# Bundle APP files
COPY build .
import axios from 'axios';
axios.get('/popular')
.then(res => {
console.log(res.data);
});
@krazyjakee
krazyjakee / Scrollbar.jsx
Created April 23, 2019 14:16
A small wrapper around react-scrollbars-custom to give it autohiding scrollbars
import React, { useState } from 'react';
import RSC from 'react-scrollbars-custom';
export default ({ autoHide, children, ...props }) => {
const [inUse, setInUse] = useState();
const style = { style: autoHide && { display: inUse ? null : 'none' }};
return <RSC
trackXProps={style}
trackYProps={style}
@krazyjakee
krazyjakee / DownloadMixamoByJakeCattrall.js
Last active October 31, 2024 15:55 — forked from TheLouisHong/DownloadMixamoByLouisHong.js
Downloads all the free Mixamo Animations
function trigger(el, eventType) {
if (typeof eventType === 'string' && typeof el[eventType] === 'function') {
el[eventType]();
} else {
const event =
eventType === 'string'
? new Event(eventType, {bubbles: true})
: eventType;
el.dispatchEvent(event);
}