Skip to content

Instantly share code, notes, and snippets.

@webspectyler
webspectyler / updateDudaManifest.php
Last active May 10, 2021 13:34
Run in Tinker to make changes to the Duda manifest.
<?php
use \Webspec\Duda\Duda;
$duda = new Duda;
$manifest = $duda->getAppManifest();
//dd($manifest);
$manifest['wl_app_profile']['en']['app_name'] = $manifest['app_profile']['en']['app_name'];
$manifest['wl_app_profile']['en']['app_logo'] = $manifest['app_profile']['en']['app_logo'];
@webspectyler
webspectyler / HandleExceptions.php
Created June 4, 2019 14:17
Countable error in Laravel with PHP 7.2
<?php
// vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:56
public function handleError($level, $message, $file = '', $line = 0, $context = [])
{
if (error_reporting() & $level) {
if (strpos($message, 'Parameter must be an array or an object that implements Countable') !== false)
return;
>>> $user->password = Hash::make('thanhnd123');
=> "$2y$10$At6GpoCsB.BQOacms87fAubGRMtu2UqJ44f53IN2EdT43IGDI.5oO"
>>> $user->save()
@webspectyler
webspectyler / resolve_504_gateway_timeout_in_nginx.md
Last active May 28, 2019 15:38
Resolve 504 Gateway timeout in nginx

It may not be possible to disable it at all, yet a feasible workaround is to increase the execution time. On a nginx tutorial site, it was written:

If you want to increase time-limit for all-sites on your server, you can edit main nginx.conf file:

sudo vim /etc/nginx/nginx.conf Add following in http{..} section

http {
     fastcgi_read_timeout 3000;
 proxy_read_timeout 3000;
@webspectyler
webspectyler / allowrootlogin.sh
Created May 13, 2019 23:05
Forge loses connection to Digital Ocean droplet
su root
vi /etc/ssh/sshd_config
#uncomment the line below:
PermitRootLogin yes
systemctl restart ssh
@webspectyler
webspectyler / show-varnish-hits-in-log.sh
Created June 22, 2016 21:25
Show varnish hits in log
varnishncsa -c -m "TxHeader:X-Varnish-Cache: HIT" | grep example.com
@webspectyler
webspectyler / gist:167671d01fbdba80976d99d62bfc9eae
Created June 13, 2016 14:02 — forked from craiggists/gist:2268146
SublimeText: Tab to move cursor out of parentheses, quotes, brackets
// Original by C0D312
// I added the single quote and curly brace to the regex.
// http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5174
//
// Add the following to your user keybindings:
[
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)}'\"\\]]", "match_all": true },
@webspectyler
webspectyler / queries.sql
Created December 9, 2013 19:05
Clicks and 90 day survey responses
# (Below are the queries that generated these files, for my reference)
SELECT `247_response`. * , `247_contract`.`title`
FROM `247_response`
LEFT JOIN `247_contract` ON `247_response`.`contract_id` = `247_contract`.`contract_id`
ORDER BY `response_id` DESC
# ^ Survey Responses
SELECT `247_click`. * , `247_contract`.`title`
@webspectyler
webspectyler / .gitconfig
Created November 14, 2013 19:40
Git aliases
s = status
a = add
co = checkout
cm = commit
unadd = reset HEAD
df = diff -w
ds = diff --staged
st = status -sb
amend = commit --amend -C HEAD
undo = reset --soft HEAD^
@webspectyler
webspectyler / fixperms.sh
Created October 9, 2013 13:00
Fix permissions in cPanel when getting 500 errors and Forbidden 403 errors
#! /bin/bash
#
# Date: Jan 26th 2012
# Author: Colin R.
# Revisions: Jacob "Boom Shadow" Tirey (boomshadow.net)
# Fixperms script for ServInt
#
# Fixperms script for cPanel servers running suPHP or FastCGI.
# Written for ServInt.net
# Copyright (C) 2012 Colin R.