Skip to content

Instantly share code, notes, and snippets.

// Tooltips
function positionTooltip(element, event) {
var left = event.clientX + 20 + element.width() > window.innerWidth ?
window.innerWidth - element.width() - 20 : event.clientX + 10;
var top = event.clientY + 20 + element.height() > window.innerHeight ?
event.clientY - element.height() - 30 : event.clientY + 20;
element.css({'left': left + 'px', 'top': top + 'px'});
}
$(document).on('mousemove', function (event) {
@ToxicTree
ToxicTree / build_translations.js
Last active August 21, 2019 19:52
Node.js script to concat .csv files with translations into a single .json file.
const fs = require('fs');
const localizationDir = "";
const buildDir = "build";
function showHelp() {
console.log(
"\nUsage: "
+ "node "
+ process.argv[1].substring(process.argv[1].lastIndexOf("\\") + process.argv[1].lastIndexOf("/") + 2)
@ToxicTree
ToxicTree / imgData.js
Last active February 6, 2017 11:51
HTML5 Canvas: Pixel manipulation with X & Y
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
// Create some imgData (100 x 100)
var imgData = ctx.createImageData(100, 100);
// Fill every pixel red in imgData
// Example from: http://www.w3schools.com/tags/canvas_imagedata_data.asp
var i;
for (i = 0; i < imgData.data.length; i += 4) {
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {