Skip to content

Instantly share code, notes, and snippets.

// Simple spreadsheet, with first sheet containing form submission repsonses
// when the form is submitted:
// 1) grab the latest response,
// 2) post it to a third party service via an HTTP POST
function testWebhook() {
var ss = SpreadsheetApp.openById(SPREADSHEET_ID);
var form=ss.getSheets()[0];
var lr=form.getLastRow();
var el=form.getRange(lr,2,1,1).getValue();
var t=el;
@aquilax
aquilax / MY_Output.php
Created November 4, 2011 08:40
CodeIgniter static website generator
<?php
/**
* Creates static version of CodeIgniter site
*
* @author aquilax
*/
class MY_Output extends CI_Output {
function __construct() {
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@maxpert
maxpert / param_call.php
Created July 1, 2012 12:31
PHP named parameter calling
<?php
$x = function($bar, $foo="9") {
echo $foo, $bar, "\n";
};
class MissingArgumentException extends Exception {
}
function call_user_func_named_array($method, $arr){
@sgmurphy
sgmurphy / url_slug.php
Created July 12, 2012 15:52
URL Slugs in PHP (with UTF-8 and Transliteration Support)
<?php
/**
* Create a web friendly URL slug from a string.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <sean@iamseanmurphy.com>
* @copyright Copyright 2012 Sean Murphy. All rights reserved.
@marekjelen
marekjelen / gist:3731919
Created September 16, 2012 10:40
OpenShift @ Ubuntu
# Resources:
#
# * http://bencord0.wordpress.com/2012/08/11/openshift/
#
# Starting with clean install of Ubuntu for start
# Update the system
apt-get update
apt-get upgrade
@hayajo
hayajo / changelog_en.md
Last active May 3, 2024 08:29
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@cbmd
cbmd / default.conf
Created December 9, 2012 21:13
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@edtoon
edtoon / gist:6358598
Last active December 21, 2015 20:00
example mod_vhost_dbd / wildcard hosting server
#########################
# install binary stuffs #
#########################
apt-get install apache2 apache2-prefork-dev libaprutil1-dbd-mysql unzip mysql-server
mkdir -p /usr/local/src/mod_vhost_dbd
cd /usr/local/src/mod_vhost_dbd
wget http://dbd-modules.googlecode.com/files/dbd-modules-1.0.6.zip
unzip dbd-modules-1.0.6.zip
apxs2 -c mod_vhost_dbd.c