Skip to content

Instantly share code, notes, and snippets.

View jaybill's full-sized avatar

Jaybill McCarthy jaybill

View GitHub Profile
@jaybill
jaybill / getWhereClauseForKeywords.php
Created March 3, 2012 02:19
getWhereClauseForKeywords
function getWhereClauseForKeywordsTwo($keywords)
{
$keywords = explode(" ", $keywords);
$select = $this->select();
foreach ($keywords as $word)
{
$subselect = $this->select();
@jaybill
jaybill / build.properties
Created March 3, 2012 23:37
Here are build and build properties file. If you want to do the deploy, there's one jar file you'll need in addition to ant. (jsch)
ssh_username=REPLACE_WITH_USERNAME
ssh_password=REPLACE_WITH_PASSWORD
ssh_remote_host=groupofthings.com
production_db_name=groupofthings
production_db_user=groupofthings
production_db_pass=REPLACE_WITH_PASSWORD
local_db_name=groupofthings
local_db_user=groupofthings
local_db_pass=REPLACE_WITH_PASSWORD
local_deploy=/home/jaybill/sites/groupofthings/htdocs
<div class="rivety-form-field ui-corner-all">
<label for="property_type">{t}Type{/t}</label>
<div class="buttonset" id="property_type"><input type="radio" id="text" value="text" name="property_type" /><label for="{t}Text{/t}">{t}Text{/t}</label><input type="radio" id="date" value="date" name="property_type" /><label for="{t}Date{/t}">{t}Date{/t}</label><input type="radio" id="number" value="number" name="property_type" /><label for="{t}Number{/t}">{t}Number{/t}</label></div>
</div>
@jaybill
jaybill / server.go
Created April 25, 2012 21:29
Trailing slash forces GET method on request?
package main
import(
"net/http"
"log"
"fmt"
)
func route(pattern string, fn func(*http.Request) string){
http.HandleFunc(pattern,makeHandler(fn))
@jaybill
jaybill / server.go
Created May 2, 2012 15:21
gorilla sessions issue
package main
import (
"net/http"
"code.google.com/p/gorilla/sessions"
"log"
)
var store = sessions.NewCookieStore([]byte("something-very-secret"))
@jaybill
jaybill / server.go
Created May 3, 2012 15:07
Type assertions on session values.
package main
import (
"encoding/gob"
"net/http"
"code.google.com/p/gorilla/sessions"
"log"
)
@jaybill
jaybill / copytree.go
Created June 5, 2012 17:46
How to copy a directory tree (preserving permissions) in Go.
package main
import "fmt"
import "os"
import "io"
import "io/ioutil"
import "log"
// Copies file source to destination dest.
func CopyFile(source string, dest string) (err error) {
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder
$args = array(
...
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'publish_date', // name of your custom field
'value' => time(),
'compare' => '<',
),
@jaybill
jaybill / gist:5724847
Last active December 18, 2015 04:19 — forked from jlengstorf/gist:4121599
cat pdc-dev-6-6-13.sql | sed -e 's/pdc-2468.liquidagencydev.com/pdc.dev-vm/g' > pdc-dev-6-6-13_LOCAL.sql