Skip to content

Instantly share code, notes, and snippets.

View ingageco's full-sized avatar

Jay Hughes ingageco

View GitHub Profile
@vxnick
vxnick / gist:380904
Created April 27, 2010 15:52
Array of country codes (ISO 3166-1 alpha-2) and corresponding names
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@johnmegahan
johnmegahan / functions.php
Created January 12, 2012 01:50
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
@boogah
boogah / .htaccess
Created February 16, 2012 04:59
Expire headers .htaccess code.
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"
# Data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"
@sbruner
sbruner / gist:1845471
Created February 16, 2012 15:03
Custom BuddyPress Activity Stream
<?php
/* = Generate Custom Activity Stream
-----------------------------------------------
* Place this function anywhere you want to show your custom stream.
* Should accept any of these parameters:
* http://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-activity-stream-loop/
*/
@nrk
nrk / command.txt
Created April 2, 2012 19:19
Using ffprobe to get info from a file in a nice JSON format
ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4" > "lolwut.mp4.json"
@16am
16am / Remove original size image.txt
Last active November 27, 2020 00:27
Remove original size image from WordPress Upload Directory after upload
add_filter( 'wp_generate_attachment_metadata', 'delete_fullsize_image' );
function delete_fullsize_image( $metadata )
{
$upload_dir = wp_upload_dir();
$full_image_path = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
$deleted = unlink( $full_image_path );
return $metadata;
}
@brianwebb01
brianwebb01 / foreman-sample.json
Created February 25, 2014 02:21
Sample Foreman template to follow hexagonal architecture found here: http://git.io/9NY65w
{
"structure": {
"copy": [
{
"from": "/projects/hex-arch-laravel/app/lib/Contracts/Instances/InstanceInterface.php",
"to": "app/lib/Contracts/Instances/InstanceInterface.php"
},
{
"from": "/projects/hex-arch-laravel/app/lib/Contracts/Notification/CreatorInterface.php",
"to": "app/lib/Contracts/Notification/CreatorInterface.php"
@subudeepak
subudeepak / WebSockets.md
Last active May 31, 2024 09:36
The problems and some security implications of websockets - Cross-site WebSockets Scripting (XSWS)

WebSockets - An Introduction

WebSockets is a modern HTML5 standard which makes communication between client and server a lot more simpler than ever. We are all familiar with the technology of sockets. Sockets have been fundamental to network communication for a long time but usually the communication over the browser has been restricted. The general restrictions

  • The server used to have a permanent listener while the client (aka browser) was not designated any fixed listener for a more long term connection. Hence, every communication was restricted to the client demanding and the server responding.
  • This meant that unless the client requested for a particular resource, the server was unable to push such a resource to the client.
  • This was detrimental since the client is then forced to check with the server at regular intervals. This meant a lot of libraries focused on optimizing asynchronous calls and identifying the response of asynchronous calls. Notably t
Run this in your Mac Terminal (assuming you have the Ionic CLI):
----------------------------------------------------------------
ionic start wkwebviewpolyfilltest
cd wkwebviewpolyfilltest
ionic setup sass
ionic platform add ios
ionic plugin add https://github.com/EddyVerbruggen/cordova-plugin-wkwebview
ionic build
----------------------------------------------------------------