Skip to content

Instantly share code, notes, and snippets.

View dcyou's full-sized avatar

David Turbert dcyou

View GitHub Profile
@dcyou
dcyou / gist:06a4f6e0a770887fbd01fa8276b945c0
Created March 23, 2017 13:13 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@dcyou
dcyou / color.js
Created December 6, 2022 08:39 — forked from jurv/color.js
JS - Check if text color should be black or white, based on the background color
function shouldTextBeBlack (backgroundcolor) {
return computeLuminence(backgroundcolor) > 0.179;
}
function computeLuminence(backgroundcolor) {
var colors = hexToRgb(backgroundcolor);
var components = ['r', 'g', 'b'];
for (var i in components) {
var c = components[i];
@dcyou
dcyou / .block
Created August 26, 2022 07:59 — forked from mbostock/.block
Gradient Along Stroke
license: gpl-3.0
@dcyou
dcyou / laravel laravel-echo laravel-echo-server private channel authentication problems Common Problems faced while setting up private channels with laravel-echo & laravel-echo-server.
I'll start with the basics and proceed to addressing the common problems
faced while setting up private channels with laravel-echo & laravel-echo-server.
If you are getting these errors while setup; 401, 403, 419 etc, as I did in my experience.
this gist will help you fix these errors.
Although this gist addresses common problems of laravel-echo-server setup, some problems are similar with Pusher setup.
So it might also be useful if you're having problems with setting up Pusher with Echo.
I'll try to cover eveything and try to use appropriate highlighting to single out each common problem.
@dcyou
dcyou / bitbucket-pipelines.yml
Created July 15, 2020 05:07 — forked from szilagyiabo/bitbucket-pipelines.yml
Example Bitbucket Pipeline for Vue.js application
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:8.12.0
pipelines:
branches:
@dcyou
dcyou / GpsUtils.cs
Created June 23, 2020 07:35 — forked from govert/GpsUtils.cs
Convert WGS-84 geodetic locations (GPS readings) to Cartesian coordinates in a local tangent plane (Geodetic to ECEF to ENU)
using System;
using System.Diagnostics;
using static System.Math;
// Some helpers for converting GPS readings from the WGS84 geodetic system to a local North-East-Up cartesian axis.
// The implementation here is according to the paper:
// "Conversion of Geodetic coordinates to the Local Tangent Plane" Version 2.01.
// "The basic reference for this paper is J.Farrell & M.Barth 'The Global Positioning System & Inertial Navigation'"
// Also helpful is Wikipedia: http://en.wikipedia.org/wiki/Geodetic_datum
@dcyou
dcyou / laravel-homestead-upload-settings.md
Created June 16, 2020 10:29
Image upload settings to be run on a standard Laravel Homestead box

These will directly zap your php.ini file with the settings you want.

sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.1/fpm/php.ini

sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.1/fpm/php.ini

sudo sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.1/fpm/php.ini

Then, we need to set a proper client_max_body_size in the nginx.config file:

@dcyou
dcyou / Response.php
Created June 3, 2020 05:30 — forked from jeffochoa/Response.php
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@dcyou
dcyou / .bash_profile
Last active May 1, 2020 08:54 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@dcyou
dcyou / Pi.md
Last active February 5, 2019 14:48 — forked from jgamblin/Pi.txt
PoisonTap Install Commands

Server:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion