This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: window.sleepFn = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
window.processingLog = false; | |
window.processedLogs = 0; | |
clearInterval(window.roundingInterval); | |
window.visibleTogglEvents = Array.from(document.querySelectorAll(".rbc-event")); | |
window.visibleTogglEventsCount = window.visibleTogglEvents.length; | |
window.roundingInterval = setInterval(async () => { | |
if (window.processingLog) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LC_NUMERIC="en_US.UTF-8" | |
START_TIME=$SECONDS | |
set -e | |
echo "-----START GENERATING HLS STREAM-----" | |
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME] | |
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1 | |
# comment/add lines here to control which renditions would be created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function homestead() { | |
( cd ~/Homestead && vagrant $* ) | |
} | |
export -f homestead | |
## SSH to box and cd to same directory as current dir on local machine. If machine is offline, start it up before ssh to it | |
function homessh() { | |
if homestead status --machine-readable | grep state,running > /dev/null 2>&1; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Admin\Contracts; | |
/** | |
* Instead of "Nested Set pattern" use only "order" column to reorder the items in the database. | |
* Database columns needed: id, name, order | |
* | |
* @return | |
*/ | |
trait SimpleReorderTrait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Leverage Browser Caching | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType image/jpg "access 1 year" | |
ExpiresByType image/jpeg "access 1 year" | |
ExpiresByType image/gif "access 1 year" | |
ExpiresByType image/png "access 1 year" | |
ExpiresByType image/svg+xml "access 1 year" | |
ExpiresByType text/css "access 1 month" | |
ExpiresByType text/html "access 1 hour" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"""Replacement for htpasswd""" | |
# Original author: Eli Carter | |
import os | |
import sys | |
import random | |
from optparse import OptionParser | |
# We need a crypt module, but Windows doesn't have one by default. Try to find |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# A SHORT DESCRIPTION OF YOUR SCRIPT GOES HERE | |
# USAGE: | |
# DESCRIPTION OF ENV VARS HERE | |
############################################################################### | |
set -e # exit on command errors (so you MUST handle exit codes properly!) | |
set -o pipefail # capture fail exit codes in piped commands | |
#set -x # execution tracing debug messages | |
# Get command info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Section "InputClass" | |
Identifier "Marble Mouse" | |
MatchProduct "Logitech USB Trackball" | |
MatchIsPointer "on" | |
MatchDevicePath "/dev/input/event*" | |
Driver "evdev" | |
Option "SendCoreEvents" "true" | |
Option "Buttons" "9" | |
Option "ButtonMapping" "1 8 3 4 5 6 7 2 9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function file_put_contents_atomic($filename, $content) { | |
$temp = tempnam(FILE_PUT_CONTENTS_ATOMIC_TEMP, 'temp'); | |
if (!($f = @fopen($temp, 'wb'))) { | |
$temp = FILE_PUT_CONTENTS_ATOMIC_TEMP . DIRECTORY_SEPARATOR . uniqid('temp'); | |
if (!($f = @fopen($temp, 'wb'))) { | |
trigger_error("file_put_contents_atomic() : error writing temporary file '$temp'", E_USER_WARNING); | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takes [count] of items and the [partition] (array of percentages) to | |
// distribute against. Returns an array of integers that sums to [count]: | |
// an integer composition weighted by the partition. | |
// | |
// We don't use the Bresenham algorithm because it doesn't provide the best | |
// results for low values of [count]. | |
function DISTRIBUTE(count, partition) { | |
// Custom function in Apps Script takes a 2D array. We're only interested in | |
// the first row. | |
partition = partition[0]; |
NewerOlder