Skip to content

Instantly share code, notes, and snippets.

View jeremyjaymes's full-sized avatar

Jeremy jeremyjaymes

View GitHub Profile
@fideloper
fideloper / stream_file.php
Last active January 17, 2024 18:41
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
@dbisso
dbisso / 10_blackfire_repo.config
Last active February 1, 2023 15:12
Set up Blackfire on AWS Elastic Beanstalk
commands:
01_add_blackfire_repo:
command: "sudo yum install -y pygpgme && wget -O - 'http://packages.blackfire.io/fedora/blackfire.repo' | sudo tee /etc/yum.repos.d/blackfire.repo"
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
@markhowellsmead
markhowellsmead / array_find.js
Created April 20, 2016 14:49
Polyfill JavaScript Array.prototype.find for older browsers (e.g. IE 10, IE 11)
if (!Array.prototype.find) {
Array.prototype.find = function(predicate) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
# Set composer folder for this command and update
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
# Add environment variable to set composer home folder
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active April 22, 2024 17:19
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@hissy
hissy / importer-class-filter-example.php
Last active July 2, 2020 10:47
[Really Simple CSV Importer] add-on: Update row based on a custom field ID/key match
<?php
/*
Plugin Name: Update row based on a custom field ID/key match
Plugin URI: https://wordpress.org/support/topic/update-row-based-on-a-custom-field-idkey-match
*/
add_filter('really_simple_csv_importer_class', function() {
return "ImporterCustomize";
});
@certainlyakey
certainlyakey / functions.php
Last active August 29, 2015 14:05
Wordpress - import data from CSV table with custom column names (Really Simple CSV importer plugin)
<?php
// Goes in custom rscsvimporter_replace_save_post class before actual writing to db ($ph->add_meta, $ph->add_terms, $ph->update, $ph->insert). See here https://gist.github.com/hissy/1ea54a46fd07be9f4334
if ($meta['Title']) {
$meta_title = $meta['Title'];
$post['post_title'] = trim($meta_title);
}
$tax_map = array(
'Region' => 'regregion',