Skip to content

Instantly share code, notes, and snippets.

View fgilio's full-sized avatar

Franco Gilio fgilio

View GitHub Profile
@frankdejonge
frankdejonge / example.php
Created October 31, 2014 15:01
Flysystem Download from FTP
<?php
$ftp = new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Ftp($settings));
$local = new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Local($path));
$local->write($destination, $ftp->read($source));
@nguyenDalex
nguyenDalex / getCardinalDirection
Last active August 29, 2015 14:12
forecast io Cardinal Direction from windbearing javascript funciton
function getCardinalDirection(input) {
var directions = ["N", "NE", "E", "SE", "S", "SW", "W", "NW", "N"];
var index = Math.floor( ((input-22.5)%360) / 45 );
return directions[index+1];
}
@bradwestfall
bradwestfall / gist:c3e44d5c1e4a74ad852e
Last active August 25, 2017 16:35
OS X (Yosemite) Apache Environment Setup

OS X (Yosemite) Apache Environment Setup

Instructions for setting up a basic Apache environment on OS X Yosemite Only. For Mavericks, view this guide

For this guide, square brackets are used to denote places where you need to plugin your own stuff. In none of these cases are you supposed to use actual square brackets.

Note that /private/etc and /etc go to the same place on Yosemite. This is good to know for later.

If you've already configured Apache correctly and you just want to know the part about setting up a new Virtual Host, then you can skip to that section. If not, then you'll need to configure Apache.

@pudgereyem
pudgereyem / gist:c5757e11000cd462b07a
Created February 5, 2015 16:10
Serve Missing Media from a Production Server via Apache/Nginx
# Serve Missing Media from a Production Server via Apache/Nginx
# When working on the website locally, and you don't want to download (or even have) the images that are used on the live site, a simple redirect solves the problem. You can read a good blog post on this here; <http://rzen.net/serve-missing-media-production-apache-nginx/> by Brian Richards.
###
### For Apache
###
# Attempt to load files from production if they're not in our local version
# If you have development/production setup, it's neat to use .htaccess to redirect all failed requests to the production server (since we wont want to sync all the uploaded media between the two)
<IfModule mod_rewrite.c>
@tomazzaman
tomazzaman / README.md
Last active September 17, 2023 20:59
Gulp workflow for WordPress theme development

Gulp workflow for WordPress theme development

Requirements

In order for Livereload to work, you need a Firefox or Chrome extension as Gulp doesn't inset it automatically. Alternatively, you can also manually put the livereload script in footer.php, just make sure to insert it only on development environment:

<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@thomasgriffin
thomasgriffin / api-helper.php
Last active March 13, 2019 13:46
API Helper to be used during API requests. Should be used as a must-use plugin in WordPress.
<?php
/**
* Plugin Name: TGM API Helper
* Plugin URI: https://thomasgriffin.io
* Description: Whitelists the plugins to be loaded during API requests to reduce overhead.
* Author: Thomas Griffin
* Author URI: https://thomasgriffin.io
* Version: 1.0.0
*/

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma

@petenelson
petenelson / gga-api-helper.php
Created March 20, 2015 00:09
WordPress: Prevent specific plugins from loading during /api/ requests
<?php
/**
* Plugin Name: GGA API Helper
* Description: Prevents certain plugins from being loaded during API requests to reduce overhead.
* Author: Pete Nelson (@GunGeekATX)
* Version: 1.0.0
*/
/*
@jdevalk
jdevalk / logging-helper.php
Last active December 9, 2021 16:25
This little hack enables fatal error logging for your site, without creating an error log that is insanely big.
<?php
/**
* This changes logging to only log fatal errors. This file should go in your mu-plugins directory.
*/
// Set the error logging to only log fatal errors
error_reporting( E_ERROR );
// Optional: change the location of your error log, it might be wise to put it outside your WP content dir.
// If you don't change it, the default place for this log is debug.log in your WP_CONTENT_DIR.
@rarylson
rarylson / automator_new_file.scpt
Last active March 1, 2024 01:03
AppleScript to create a new file in Finder (to be used in Automator)
-- AppleScript to create a new file in Finder
--
-- Use it in Automator, with the following configuration:
-- - Service receives: no input
-- - In: Finder.app
--
-- References:
-- - http://apple.stackexchange.com/a/129702
-- - http://stackoverflow.com/a/6125252/2530295
-- - http://www.russellbeattie.com/blog/fun-with-the-os-x-finder-and-applescript