Skip to content

Instantly share code, notes, and snippets.

View michaelaguiar's full-sized avatar
🎯
Focusing

Michael Aguiar michaelaguiar

🎯
Focusing
View GitHub Profile
@michaelaguiar
michaelaguiar / drual_permissions.sh
Last active December 18, 2015 22:39
Small script to update Drupal Permissions
#!/bin/bash
DRUPAL_PATH=${1%/}
DRUPAL_USER=${2}
APACHE_GROUP="www-data"
echo 'Setting owner / group to source';
chown -R $DRUPAL_USER:staff $DRUPAL_PATH
echo 'Fixing file and directory permissions';
@michaelaguiar
michaelaguiar / browser_install.sh
Last active December 18, 2015 17:29
Install all major browsers for testing.
# Install Cask
brew tap phinze/homebrew-cask
brew install brew-cask
# Install Browsers
brew cask install google-chrome
brew cask install firefox
brew cask install opera
@michaelaguiar
michaelaguiar / adwords_bad_url.js
Created May 15, 2013 20:44
Google Adwords Script - Report Broken URLs
function main() {
var BAD_CODES = [404,500],
TO = ['[email protected]'],
SUBJECT = 'Broken Url Report - ' + _getDateString(),
HTTP_OPTIONS = {
muteHttpExceptions:true
},
iters = [
// Ad Level Urls
AdWordsApp.ads().withCondition("Status = 'ENABLED'").get(),
@michaelaguiar
michaelaguiar / functions.php
Created March 23, 2013 18:29
Wordpress XMLRPC Authentication from external app
<?php
add_filter('xmlrpc_methods', 'wpse39662_add_login_method');
function wpse39662_add_login_method($methods)
{
$methods['wpse39662.login'] = 'wpse39662_check_login';
return $methods;
}
function wpse39662_check_login($args)
@michaelaguiar
michaelaguiar / http_headers.php
Created December 18, 2012 00:12
PHP HTTP Headers
<?php
// See related links for more status codes
// Use this header instruction to fix 404 headers
// produced by url rewriting...
header('HTTP/1.1 200 OK');
// Page was not found:
header('HTTP/1.1 404 Not Found');
@michaelaguiar
michaelaguiar / remote_exists.php
Created November 30, 2012 22:30
Check if remote file exists
$ch = curl_init(FILEURL);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($retcode === 200) {
// Pass
} else {
@michaelaguiar
michaelaguiar / gmaps.js
Created November 24, 2012 19:31
Display markers on map
/*!
* GMaps.js v0.2.26
* http://hpneo.github.com/gmaps/
*
* Copyright 2012, Gustavo Leon
* Released under the MIT License.
*/
if(window.google && window.google.maps){
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@michaelaguiar
michaelaguiar / processes.sh
Created October 22, 2012 18:10
View current processes using specific port - Ubuntu
sudo netstat -lpn |grep :80
@michaelaguiar
michaelaguiar / media_queries.css
Last active August 16, 2017 18:42
CSS Media Queries
/* Smartphones (portrait and landscape) ----------- */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 321px) {
/* Styles */
}