Skip to content

Instantly share code, notes, and snippets.

View mattcdavis1's full-sized avatar

Matt Davis mattcdavis1

View GitHub Profile
$('[name="playa[channels][]"] option').each(function() {
var optionText = $(this).text().toLowerCase();
if(optionText.indexOf("team") !== -1 || optionText.indexOf("people") !== -1) {
$(this).attr('selected', 'selected');
}
});
@mattcdavis1
mattcdavis1 / git-remove-history.sh
Created July 5, 2013 14:16
Remove item from git history
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0
@mattcdavis1
mattcdavis1 / get_facebook_token.php
Created July 8, 2013 18:58
Get a facebook token and posts from a facebook page
<?php
$tokenUrl = 'https://graph.facebook.com/oauth/access_token?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials';
$token = file_get_contents($tokenUrl);
$postsUrl = 'https://graph.facebook.com/{page_id or slug}/posts?' . $token;
$postsJson = file_get_contents($postsUrl);
$posts = json_decode($postsJson);
@mattcdavis1
mattcdavis1 / pixel_replace.php
Created November 17, 2013 08:22
Replace all pixels of one color with pixels of another color
<?php
$img = \imagecreatefromjpeg('someimage.jpg');
for ($y = 0; $y < imagesy($img); $y++) {
for ($x = 0; $x < imagesx($img); $x++) {
// find color index at x,y
$pixelColorIndex = imagecolorat($img, $x, $y);
$pixelColorRGB = imagecolorsforindex($img, $pixelColorIndex);
// set new color if test color matches
if ($pixelColorRGB['red'] == 255 && $pixelColorRGB['green'] == 255 && $pixelColorRGB['blue'] == 255) {
@mattcdavis1
mattcdavis1 / installer.html
Created November 1, 2014 16:31
Streams Install Issue
<!doctype html>
<!--[if lt IE 7]>
<html class="nojs ms lt_ie7" lang="en"><![endif]-->
<!--[if IE 7]>
<html class="nojs ms ie7" lang="en"><![endif]-->
<!--[if IE 8]>
<html class="nojs ms ie8" lang="en"><![endif]-->
<!--[if gt IE 8]>
@mattcdavis1
mattcdavis1 / install_error_1.txt
Created November 3, 2014 21:23
install error
PHP Fatal error: Class 'Illuminate\Log\LogServiceProvider' not found in /Users/matthewdavis/Code/web/pyrocms.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 158
PHP Stack trace:
PHP 1. {main}() /Users/matthewdavis/Code/web/pyrocms.com/artisan:0
Fatal error: Class 'Illuminate\Log\LogServiceProvider' not found in /Users/matthewdavis/Code/web/pyrocms.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 158
Call Stack:
0.0006 227248 1. {main}() /Users/matthewdavis/Code/web/pyrocms.com/artisan:0
0.0195 1740072 2. Anomaly\Streams\Platform\Console\Kernel->handle(???, ???) /Users/matthewdavis/Code/web/pyrocms.com/artisan:46
0.0195 1740168 3. Illuminate\Foundation\Console\Kernel->handle(???, ???) /Users/matthewdavis/Code/web/pyrocms.com/vendor/anomaly/streams-platform/src/Anomaly/Streams/Platform/Console/Kernel.php:28
<?php namespace Anomaly\Streams\Addon\Module\Resources\Installer;
use Anomaly\Streams\Platform\Field\FieldInstaller;
/**
* Class UsersFieldInstaller
*/
class ResourceTagsFieldInstaller extends FieldInstaller
{
/**
@mattcdavis1
mattcdavis1 / installer_command.php
Last active August 29, 2015 14:08
Installer Command
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class RunInstallerCommand extends Command {
/**
* The console command name.
<?php namespace Anomaly\Streams\Addon\Module\Resources\Installer;
use Anomaly\Streams\Platform\Field\FieldInstaller;
/**
* Class UsersFieldInstaller
*/
class ResourcesFieldInstaller extends FieldInstaller
{
@mattcdavis1
mattcdavis1 / streams-profile.html
Last active August 29, 2015 14:16
Streams Profile Times
Illuminate\Events\EventServiceProvider: 0.088587045669556
Illuminate\Routing\RoutingServiceProvider: 0.088603973388672
Illuminate\Auth\AuthServiceProvider: 0.088613033294678
Illuminate\Routing\ControllerServiceProvider: 0.088622093200684
Illuminate\Cookie\CookieServiceProvider: 0.088631153106689
Illuminate\Database\DatabaseServiceProvider: 0.092144966125488
Illuminate\Encryption\EncryptionServiceProvider: 0.092159032821655
Illuminate\Filesystem\FilesystemServiceProvider: 0.092167139053345
Illuminate\Foundation\Providers\FormRequestServiceProvider: 0.092272043228149
Illuminate\Foundation\Providers\FoundationServiceProvider: 0.092282056808472