Skip to content

Instantly share code, notes, and snippets.

View jeroenbourgois's full-sized avatar
🐢

Jeroen Bourgois jeroenbourgois

🐢
View GitHub Profile
@jeroenbourgois
jeroenbourgois / nginx-main-conf
Created February 26, 2011 18:20
nginx-main-conf
worker_processes 1;
# pid of nginx master process
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
cd /usr/local/etc/nginx/
mkdir sites-available sites-enabled
@jeroenbourgois
jeroenbourgois / install-nginx.sh
Created February 26, 2011 12:39
install nginx
brew install nginx
<?php // this php tag is only included for gist to detect the file and do syntax coloring :)
// Call default or custom access callback
if (call_user_func_array($method['access callback'], $access_arguments) != TRUE) {
return services_error(t('Access denied'), 401);
}
<?php
// let's turn on error reporting
ini_set("display_errors", 1);
// include the XMLRPC library
// I used the one by keithdevens.com/software/xmlrpc
// You are free to use any library, but then the call will be different
//
// Note: this library has one big downside, it throws a lot of warnings in PHP 5, since
// it has some deprecated calls. I just hide warnings on my production site, so that was not
<!DOCTYPE html>
<head>
<title>Drupalconnect frontend</title>
<style type="text/css">
* { padding: 0; margin: 0; }
html { font-family: "Lucida grande", arial, sans-serif; color: #222;}
body { width: 800px; margin: 0 auto; }
h1 { margin: 80px 0; }
h3 { margin-bottom: 10px; }
<?php
/*
* Implementation of hook_service()
* Required by all server modules
* Returns array defining all the methods available in the service
*/
function drupalconnect_service() {
return array(
array(
<?php
/*
* Implementation of hook_disable()
* Perform necessary actions before module is disabled. (like clear the drupalconnect:methods cache)
*/
function drupalconnect_disable() {
cache_clear_all('drupalconnect:methods', 'cache');
}
/*
* Implementation of hook_enable()
; $Id: drupalconnect.info, v 0.1 $
name = Drupal Connect
description = Provide a service for an external site
package = Custom modules
core = 6.x
@jeroenbourgois
jeroenbourgois / mysql db backup script
Created February 9, 2011 21:25
Backup scripts that goes through all the mysql dbs and backups them to a backup folder, by date
#!/bin/sh
set -o errexit
nopass=0
if [ $# -eq 0 ]; then
echo "-----> No parameters passed, assuming username 'root' and empty password"
DBS=`mysql -uroot -e "show databases;"`
nopass=1