Skip to content

Instantly share code, notes, and snippets.

View mattcdavis1's full-sized avatar

Matt Davis mattcdavis1

View GitHub Profile
@mattcdavis1
mattcdavis1 / CacheAssetUrl.php
Created March 30, 2016 17:03
Cache Asset Url
<?php namespace Union\Events\OnSaveEntry;
use Craft\EntryModel;
use Craft\ElementType;
use function Craft\craft;
class PhotoAlbumsListener
{
protected $entry;
@mattcdavis1
mattcdavis1 / suit.sass
Created March 17, 2016 18:31
Suit CSS Cheat Sheet
.MyModule
// attributes (alphabetical)
background: blue;
// pseudo
&:before {
}
@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 / 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 / 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
$('[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 / export.ofx
Created April 12, 2015 01:09
Bank of America Credit Card OFX Export
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
@mattcdavis1
mattcdavis1 / strikethrough.js
Last active September 23, 2015 06:02
Strikethrough
$.Redactor.prototype.strikethrough = function()
{
return {
init: function() {
var button = this.button.add('strikethrough', 'Strikethrough');
this.button.setAwesome('strikethrough', 'fa-strikethrough');
this.button.addCallback(button, this.strikethrough.show);
Illuminate\Events\EventServiceProvider: 81.346 - ( 0.000 )
Illuminate\Routing\RoutingServiceProvider: 81.376 - ( 0.000 )
Illuminate\Auth\AuthServiceProvider: 81.391 - ( 0.000 )
Illuminate\Routing\ControllerServiceProvider: 81.405 - ( 0.000 )
Illuminate\Cookie\CookieServiceProvider: 81.419 - ( 0.000 )
Illuminate\Database\DatabaseServiceProvider: 84.428 - ( 0.003 )
Illuminate\Encryption\EncryptionServiceProvider: 84.452 - ( 0.000 )
Illuminate\Filesystem\FilesystemServiceProvider: 84.467 - ( 0.000 )
Illuminate\Foundation\Providers\FormRequestServiceProvider: 84.554 - ( 0.000 )
Illuminate\Foundation\Providers\FoundationServiceProvider: 84.571 - ( 0.000 )
@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