Skip to content

Instantly share code, notes, and snippets.

@jhaus
jhaus / gData-class.php
Created November 30, 2010 00:02
Saving Form Data to Google Spreadsheets Using PHP and the Google Docs API via: http://farinspace.com/saving-form-data-to-google-spreadsheets/
<?php
/*
Copyright (c) 2009 Dimas Begunoff, http://www.farinspace.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
@retgef
retgef / pug-bomb.php
Created June 24, 2012 07:46
Pug Bomb API Endpoint WordPress Plugin
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
<script src="//diu127fbe6pn6.cloudfront.net/shootitlive.load.v1.js?project=13&client=greenfield" async></script>
@johnantoni
johnantoni / mysql.txt
Created August 7, 2012 18:57
mysql + vagrant + remote access
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf
@philbirnie
philbirnie / Instructions
Last active January 17, 2023 20:40
Steps to Combine Wordpress and Codeigniter when CI is in a subdirectory of Wordpress
Instructions
1. Add MY_url_helper.php to CI_directory/application/helpers
2. If the CI app is already built, convert any references to *site_url* in your CI application (aside from the system directory) to the new namespaced function, ci_site_url.
This step prevents Wordpress' site_url function from overwriting CIs. Because both functions are global and CI checks to make sure that site_url has not been set. Once we load the WP bootstrap file, it will have been defined, so CI's function wll never load.
3. Add Wordpress' bootstrap file into CI_directory/index.php right above CI's bootstrap file.
4. Update wp-includes/load.php *(this is necessary if you are using CI's sessions - Wordpress mangles CI's cookies using with magic quotes. (There may be an upgrade-proof way to do this.)
@azat-co
azat-co / file-structure
Created June 6, 2013 23:24
Instagram Gallery: A demo app build with Storify API and Node.js http://storify.com/storifydev/instagram-gallery/
- index.js
- package.json
- public/js/main.js
- public/index.html
- css/bootstrap-responsive.min.css
- css/flatly-bootstrap.min.css
@chekalsky
chekalsky / tweets.redactor.js
Last active January 9, 2019 23:36
Imperavi Redactor Plugin for Embedding Tweets Usage: mention "tweets" in "plugins" setting of you redactor.
/**
* Imperavi Redactor Plugin for Embedding Tweets
* for version >= 9.1
*
* @author Ilya Chekalskiy <[email protected]>
* @version 0.2.2
*/
if (typeof RedactorPlugins === 'undefined') var RedactorPlugins = {};
RedactorPlugins.tweets = {
@jdcantrell
jdcantrell / xipio.conf
Last active November 29, 2016 16:48
nginx config for having xip.io working with local dev
upstream xip_app_server {
server localhost:8080 fail_timeout=0;
}
server {
listen 80;
server_name "~^(?<base_dir>.+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.xip.io$";
access_log /var/log/nginx/xip.access.log main;
error_log /var/log/nginx/xip.error.log;
@iandunn
iandunn / programmatic_login.php
Last active March 7, 2023 18:18
Programmatically log in a WordPress user
/**
* Programmatically logs a user in
*
* @param string $username
* @return bool True if the login was successful; false if it wasn't
*/
function programmatic_login( $username ) {
if ( is_user_logged_in() ) {
wp_logout();
@Kevinlearynet
Kevinlearynet / gist:10287914
Created April 9, 2014 16:15
MySQL query to delete 'wp_posts' rows and 'wp_postmeta' rows from a WordPress database
# Delete all posts with given post type
DELETE FROM wp_posts WHERE post_type = 'shop_order';
# Delete all orphaned post_meta
DELETE wp_postmeta FROM wp_postmeta
WHERE NOT EXISTS (
SELECT * FROM wp_posts
WHERE wp_postmeta.post_id = wp_posts.ID
);