Skip to content

Instantly share code, notes, and snippets.

@fastmover
fastmover / EmailResponse.gs
Created May 31, 2017 22:08
This will email a response to a form submission from Google Forms. Be sure to set the current project triggers to Run emailResponse from form submission.
function emailResponse(e) {
var form = FormApp.getActiveForm();
var formResponses = form.getResponses();
for (var i = 0; i < formResponses.length; i++) {
var formResponse = formResponses[i];
var itemResponses = formResponse.getItemResponses();
var output = "";
var htmlOutput = "<h1>Form Response</h1><hr>";
@fastmover
fastmover / DBClear.php
Last active April 14, 2017 17:18
Add's artisan command: artisan db:clear - removes all tables in the current database.
<?php
namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
class DBClear extends Command
{
@fastmover
fastmover / LoginController.php
Last active February 2, 2017 01:15
Login Controller for Laravel 5.3 which redirects user to where they were previously, or to the URL they we're trying to go to when they got redirected to the login page. Also allows Username or Email in the email field.
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Routing\UrlGenerator;
class LoginController extends Controller
@fastmover
fastmover / escapedquotesfix.vbs
Created January 25, 2017 21:20
Converts escaped quotes: \" into Microsoft escaped quotes: "" in a text/CSVfile.
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.IgnoreCase = True
objRegEx.Pattern = "\"""
File1 = WScript.Arguments.Item(0)
@fastmover
fastmover / wpFeaturedImage.sql
Created January 10, 2017 16:28
Get a WordPress featured image by Post ID, replace 12345 with your post ID.
SELECT
`wp_postmeta_1`.`meta_value`
FROM
`wp_postmeta`
INNER JOIN `wp_postmeta` `wp_postmeta_1`
ON `wp_postmeta`.`meta_value` = `wp_postmeta_1`.`post_id`
WHERE
(`wp_postmeta`.`post_id` = 12345) AND
(`wp_postmeta`.`meta_key` = '_thumbnail_id') AND
(`wp_postmeta_1`.`meta_key` = '_wp_attached_file')
@fastmover
fastmover / .php_cs
Created December 31, 2016 19:55
PHP CS Fixer 2.x project file
<?php
if (class_exists('PhpCsFixer\Finder')) {
$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
@fastmover
fastmover / .gitignore
Created November 3, 2016 17:29
Laravel Git Ignore File
/node_modules
/public/storage
/vendor
/.idea
Homestead.json
Homestead.yaml
.env*
*bower_components*
*.js.map
*.css.map
nano
bind-utils (dig)
@fastmover
fastmover / deploy.sh
Created October 4, 2016 18:24 — forked from kjohnson/deploy.sh
Ninja Forms deploy script
#!/bin/sh
# By Mike Jolley, based on work by Barry Kooij ;)
# License: GPL v3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
function powerPressHTTPStoHTTP( $ID = false, $post = false, $update = false )
{
if( ! $ID )
return;
if( isset( $_REQUEST[ 'Powerpress' ] ) and is_array( $_REQUEST[ 'Powerpress' ] ) ) {
$powerPress = $_REQUEST[ 'Powerpress' ];