Skip to content

Instantly share code, notes, and snippets.

View gseilheimer's full-sized avatar

Gilbert Seilheimer gseilheimer

View GitHub Profile
@adamharley
adamharley / random-image-widget.js
Created August 23, 2011 16:36
WP AJAX random image widget
jQuery(document).ready(function($) {
$.post(ajaxurl, {action:'random_image_widget'}, function(feedback){
image = jQuery.parseJSON(feedback);
img = $('<img src="'+image.thumb+'" />');
$('.widget_equesrandomimagewidget').append(img);
$(img).wrap('<a href="'+image.full[0]+'" width="'+image.full[1]+'" height="'+image.full[2]+'"></a>');
Shadowbox.setup(img.parent());
});
});
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active January 30, 2024 02:30
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active April 2, 2024 18:45
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@gthln
gthln / gist:8401080
Created January 13, 2014 14:23
Install Composer on Managed Hosting at Domainfactory

Install Composer on Managed Hosting at Domainfactory

Step 1:

Log in to your Managed Hosting Server via SSH

Step 2:

Add these two lines to .bashrc:

@raamdev
raamdev / nginx-mamp-macports.txt
Last active February 24, 2023 08:02
These are the steps to get Nginx running alongside MAMP on a Mac.
# These steps will get nginx installed on your Mac for local development and
# testing purposes, to be used alongside MAMP (which already includes Apache).
# The following steps assume that you're running MAMP and that you already
# have php-cgi in /Applications/MAMP/bin/php/php5.4.10/bin/php-cgi.
# The start-nginx and stop-nginx scripts created at the end do not
# start or stop MySQL because it is assumed that you normally run MAMP
# with Apache + MySQL turned on and that you occasionally want to switch
# your web server to Nginx for testing purposes and that you leave MySQL running.
# This process was tested successfully on OS X 10.9.
@jakebathman
jakebathman / jsonToCsv.php
Last active June 5, 2022 21:02 — forked from Kostanos/json-to-csv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
@dergel
dergel / load_redaxo.php
Last active January 22, 2018 12:19
REDAXO Installer Datei
<?php
// info echo "REDAXO wurde bereits installiert"; exit;
error_reporting(E_ALL);
ini_set("display_errors",1);
$current_version_path = file_get_contents("http://www.redaxo.org/de/_system/_version/5/");
$install_path = './';
$install_file = $install_path.'redaxo.zip';
@Temmyhlee
Temmyhlee / functions.php
Created December 18, 2017 05:47
Security for WordPress, headers, Strict-Transport-Security
/*
* This file is just for WordPress security and thats about it
* Copy in functions.php
* Uses send_headers as opposed to wp_header so as to ensure it works even when the webiste is cached
*/
add_action('send_headers', function(){
// Enforce the use of HTTPS
header("Strict-Transport-Security: max-age=31536000; includeSubDomains");
// Prevent Clickjacking
@staabm
staabm / navigation_iterator.php
Last active July 30, 2020 14:07
redaxo navigation iterator
<?php
/**
* Klasse zum Erstellen von Navigationen, v0.1.
*
* benötigt PHP7!
*
* @package redaxo\structure
*/
@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();