Skip to content

Instantly share code, notes, and snippets.

@FrostyX
FrostyX / FacebookDebugger.php
Last active February 9, 2022 11:15
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.
@travist
travist / gist:11381206
Last active August 29, 2015 14:00
Shell Command line to return all of PHP configurations in a list.
php -i | grep 'Configure Command =>' | awk '{for(i=5; i<=NF; i++) {print substr($i, 2, (length($i) - 2))}}'
@morewry
morewry / _debug-map.scss
Created March 13, 2014 06:21
Sass print-map function and mixin for quick debugging of maps
/*
# Print Map
Usage:
// option 1
.debug {
@include print-map($map);
}
@benosman
benosman / example_style.inc.php
Last active December 27, 2015 07:29
Example Panels style plugin with substyles. You add this to your module or theme in the normal way for ctools / panels plugins. FIlename should end in .inc.
<?php
/**
* @file
* Definition of the 'bootstrap_style' panels style plugin.
*/
$plugin = array(
'title' => t('Example Parent Style'),
'description' => t('Example style providing substyles'),
@Stanback
Stanback / nginx.conf
Last active May 23, 2024 14:37 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@markhalliwell
markhalliwell / gist:5249012
Last active March 11, 2016 11:44
Redirect local sand-boxed Drupal file requests to a development server. This helps avoid having to sync (sometimes, very huge) file structures onto your local machine.
### Apache Rewrite
# Request resides in your 'sites/default/files' folder.
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$
# File doesn't exist.
RewriteCond %{REQUEST_FILENAME} !-f
# Directory doesn't exist.
RewriteCond %{REQUEST_FILENAME} !-d
# Redirect request to your development or production server.
RewriteRule ^/sites/default/files/(.*)$ http://dev.example.com/sites/default/files/$1 [L]
@benclark
benclark / gist:4667006
Created January 29, 2013 19:37
Mobile detection in .htaccess file
###
# BEGIN MOBILE REDIRECTS
###
# If the skipMobileDetection cookie is set, and we're on the mobile domain,
# return to the normal domain. Do this only for SSL as Varnish will handle
# for port 80.
RewriteCond %{HTTP_COOKIE} skipmobiledetection [NC]
RewriteCond %{HTTP_HOST} ^m\. [NC]
RewriteCond %{SERVER_PORT} =443
@crittermike
crittermike / gist:3503791
Last active February 2, 2019 20:11
Import gzipped MySQL DB dump but ignore data from specific tables
# REGULAR VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | mysql -u root -p databasename
# DRUPAL VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | drush sqlc
@CashWilliams
CashWilliams / fix_prefix.php
Created June 29, 2012 02:28
Drupal 7 drush script to remove database prefix
<?php
// current table prefix to be removed
$prefix = "drup_";
// echo generated statments rather then run them
$pretend = FALSE;
/////////////////////////////////////////////////////////////////////
$table_list = db_query("SHOW TABLES");
@travist
travist / gist:2562314
Created April 30, 2012 20:10
Warning: remote port forwarding failed for listen port 9000
Do the following to fix this error.
ttidwell@a:~:->$ sudo lsof|grep 9000
sshd 31533 ttidwell 9u IPv6 506614 0t0 TCP [::1]:9000 (LISTEN)
sshd 31533 ttidwell 10u IPv4 506615 0t0 TCP localhost:9000 (LISTEN)
ttidwell@a:~:->$ kill 31533