Skip to content

Instantly share code, notes, and snippets.

View fgilio's full-sized avatar

Franco Gilio fgilio

View GitHub Profile
@scottopolis
scottopolis / gist:9214367
Created February 25, 2014 18:04
Ajax WordPress posts via JSON API
<button class="button" id="get_posts">Get Posts</button>
<ul id="statuses">
</ul>
<script type="text/javascript">
/* Requires JSON API plugin installed on remote site http://wordpress.org/plugins/json-api/ */
(function(window, document, $, undefined){
@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];
}

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

@fgilio
fgilio / logging-helper.php
Last active September 20, 2015 05:54 — forked from jdevalk/logging-helper.php
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.
@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>
@jdevalk
jdevalk / dev-environment.php
Created July 23, 2015 08:33
Throw this in your dev environments mu-plugins folder and add it to your .gitignore file :)
<?php
/**
* Disables plugins on your dev environment
*
* @param $plugins
*
* @return mixed
*/
function yst_dev_env_disable_plugins( $plugins ) {
{
"name": "shelob9/router-experiment",
"require": {
"silex/silex": "~1.3",
"twig/twig": "^2.0@dev"
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"shelob9\\router\\": "src"
@mhmoudsami
mhmoudsami / fix wordpress directory and files permision
Created August 18, 2016 17:17
fix wordpress directory and files permision
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
@devonoel
devonoel / graphicsmagick.sh
Created April 22, 2014 21:14
Download and install GraphicsMagick from Source
#!/bin/bash
# Downloads and installs GraphicsMagick
curl ftp://ftp.icm.edu.pl/pub/unix/graphics/GraphicsMagick/1.3/GraphicsMagick-1.3.19.tar.gz | tar zx
cd GraphicsMagick-1.3.19
./configure
make
sudo make install
cd ..
@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.