Skip to content

Instantly share code, notes, and snippets.


Roger Stringer freekrai

View GitHub Profile
freekrai / log_js_errors.js
Created Mar 26, 2021 — forked from levelsio/log_js_errors.js
Log JS errors as a POST to your server
View log_js_errors.js
// <log errors to server>
window.onerror = function (messageOrEvent, source, lineno, colno, error) {
try {
//error message(string).Available as event (sic!) in HTML onerror = "" handler.
messageOrEvent: messageOrEvent,
//URL of the script where the error was raised(string)
source: source,
//Line number where error was raised(number)
freekrai / app_GraphQL_schema.json
Created Mar 21, 2021 — forked from 4levels/app_GraphQL_schema.json
Sample setup Lighthouse with Lumen
View app_GraphQL_schema.json
# Just the basics: User with Images
scalar DateTime @scalar(class: "DateTime")
type User {
id: ID! @globalId
name: String
email: String
created_at: DateTime!
updated_at: DateTime!
freekrai /
Created Mar 20, 2021 — forked from ppoffice/
Install Visual Studio Code (actually code-server) on Android
  1. Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.

  2. Update system packages in Termux:

    $ pkg update -y
freekrai / fauna-adapter.js
Created Nov 22, 2020 — forked from s-kris/fauna-adapter.js
faunadb adapter for next-auth for next.js
View fauna-adapter.js
// followed from next-auth repo:
// create faunadb server key
// create collections: users, accounts, sessions, verificationRequests
// create required indexes
import faunadb, { query as q } from 'faunadb';
import { v4 as uuidv4 } from 'uuid';
import { createHash, randomBytes } from 'crypto';
freekrai / .zshrc
Created Nov 17, 2020 — forked from callumlocke/.zshrc
ZSH function to auto-switch to correct Node version
View .zshrc
# ZSH function to auto-switch to correct Node version
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
View hash_djb2.php
function hash_djb2($str){
$hash = 5381;
$length = strlen($str);
for($i = 0; $i &lt; $length; $i++) {
$hash = ( ($hash << 5) + $hash ) + $str[$i];
return ($hash & 0xFFFFFFFF);
freekrai / notion2blog.js
Created Sep 16, 2020 — forked from mayneyao/notion2blog.js > Personal Blog | custom domain + disqus comment
View notion2blog.js
const MY_DOMAIN = ""
const START_PAGE = ""
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
freekrai /
Created May 14, 2020 — forked from seankross/
Install latest ffmpeg on ubuntu 12.04 or 14.04
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update

Build the application

go build -o queued *.go

Run the application

Now, to run our application, how about we start it with 2048 workers, just for kicks?

freekrai / NextValetDriver.php
Created Feb 23, 2019 — forked from james2doyle/NextValetDriver.php
A Laravel Valet driver for running generated Next.js sites. This driver assumes you have not changed the default public path (/out) in the next.config.js
View NextValetDriver.php
* NextValetDriver for running compiled next.js sites
class NextValetDriver extends BasicValetDriver
* Determine if the driver serves the request.