Skip to content

Instantly share code, notes, and snippets.

View cosmomathieu's full-sized avatar
🎯
Focusing

Cosmo Mathieu cosmomathieu

🎯
Focusing
View GitHub Profile
@lorenzocaum
lorenzocaum / site-specific-plugin-adjust-cherry-jquery.php
Last active February 20, 2018 18:24
Deactivate jQuery that is included with Cherry framework and request a compatible version for WordPress from the Google CDN
<?php
/*
Plugin Name: Update jQuery Cherry framework
Description: Deactivate jQuery that is included with Cherry framework and request a compatible version for WordPress from the Google CDN
*/
/* Begin Adding Functions Below This Line */
// Remove themes old version of jQuery and load a compatible version
add_action('wp_enqueue_scripts', 'update_jquery_for_cherry_framework', 11);
function update_jquery_for_cherry_framework() {
@JunaidQadirB
JunaidQadirB / config.php
Created May 22, 2014 07:36
Enable Class loading with Namespaces in CodeIgniter
/*
* Append this to the end of your application/config.php
* @see http://stackoverflow.com/questions/3700626/namespace-in-php-codeigniter-framework#21858556
*/
spl_autoload_extensions('.php'); // Only Autoload PHP Files
spl_autoload_register(function($classname) {
if (strpos($classname, '\\') !== false) {
@esfand
esfand / lookupstate.adoc
Last active March 3, 2023 19:23
State Lookup SQL Table
@triplepoint
triplepoint / dependency_injection_demo.php
Last active July 24, 2019 12:06
Simple demonstration of dependency injection with a container in PHP.
<?php
// --- Library classes that provide behaviors ---
/**
* In these examples:
* - The Controller needs a view renderer
* - The view renderer needs a Database and a Logger
*
* Note, that the interfaces aren't being defined here, just assume they're what you'd expect.
*/
@brandonkelly
brandonkelly / templating.md
Last active March 11, 2025 21:41
Templating in EE vs. Craft
@happycollision
happycollision / Vagrantfile
Created January 17, 2014 06:48
A nice little Vagrantfile that spins up a MySQL server and loads in the data from your .sql file sitting next to it.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This Vagrantfile (vagrantup.com) spins up a MySQL server with your data
# already loaded. Many of the settings below are the same suggestions you get
# from `vagrant init`.
#
# Just be sure that (if you want data loaded) you have your .sql file sitting
# in the directory that will be shared to the guest. Usually this is the folder
# that your Vagrantfile is in. The database and user will have the same name as
@rcotrina94
rcotrina94 / How to use Images as Radio buttons.md
Last active January 30, 2025 09:22
How to use images for radio buttons (input-radio).
@xeoncross
xeoncross / ajax.js
Last active August 3, 2023 06:06
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
/**
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
*
* @param string url
* @param object callback
* @param mixed data
* @param null x
*/
function ajax(url, callback, data, x) {
try {
@adamstac
adamstac / gist:7462202
Last active March 27, 2025 11:27
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@somatonic
somatonic / creat_zip_download.php
Last active March 6, 2018 17:33
create a zip file and send to browser
<?php
/* creates a compressed zip file */
function create_zip($files = array(),$destination = '',$overwrite = false) {
if(file_exists($destination) && !$overwrite) { return false; }
if(is_array($files)) {
foreach($files as $name => $file) {
if(!file_exists($file)) unset($files[$name]);
}
}