Skip to content

Instantly share code, notes, and snippets.

@hoosteeno
hoosteeno / datagrab_model.php
Created August 4, 2011 04:39
Make DataGrab handle custom member fields
// line 488 of datagrab_model.php
// Get author id from data if specified
if ( $author_field != "" && $author_check != "" ) {
$this->db->select( 'member_id' );
$this->db->where( $author_check, $this->datatype->get_item( $item, $author_field ) );
// hacked 20110803 by hoosteeno (dojo4)
$query = '';
if (strpos($author_check, 'm_field_id') !== FALSE) {
$query = $this->db->get( 'exp_member_data' );
@hoosteeno
hoosteeno / datagrab_model.php
Created August 4, 2011 04:46
Make DataGrab creat Solspace Tags from Tumblr categories
204 // hacked 20110803 by hoosteeno (dojo4)
205 //$tags = explode(",", $datatype->get_item( $item, $this->settings["ajw_solspace_tag"] )); #doesn't work for multiple categories tags.
206 $tags = $datatype->get_nodes( $item, $this->settings["ajw_solspace_tag"] );
@hoosteeno
hoosteeno / highrise_to_csv.rb
Created February 7, 2012 21:25
Highrise to CSV
#!/usr/bin/env ruby
require 'csv'
require 'highrise'
require 'highline/import'
require 'highrise/pagination'
# Ever wanted to move your data out of 37-Signals' Highrise? Need it in CSV form?
# Good luck! This script does its best to flatten the most important elements from
# the Highrise API. It can be improved, but it may help you get the job done.
#
@hoosteeno
hoosteeno / file.html
Created February 21, 2012 18:24
experiments with text vs. hidden inputs and javascript value updates
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<h1>This is a test</h1>
<form>
<input type="text" name="same" id="text_input" value="Initial Value" />
<input type="hidden" name="same" id="hidden_input" value="Initial Value" />
</form>
@hoosteeno
hoosteeno / table.html
Created February 22, 2012 17:23
Table Styles for Form
<html>
<head>
<title>Table Styles for Form</title>
<style>
div {border:1px solid black; padding: 20px; width:200px;}
form {display:table;}
label {display:table-row;;}
label span {display:table-cell; padding-right:10px; text-align:right;}
label input {display:table-cell;}
</style>
@hoosteeno
hoosteeno / clean_up_fnames_r.bash
Created September 14, 2012 22:47
Clean up filenames recursively (get rid of annonying characters) on osx using gsed
#/bin/bash
find $1 | while read -r infile
do
newfile=$(echo "$infile" | gsed 's/\s/_/g; s/[\!\?,]//g; s/__/_/g;' | tr [:upper:] [:lower:])
if [ "$newfile" != "$infile" ]; then
echo "mv '$infile' '$newfile'"
mv "$infile" "$newfile"
fi
done
@hoosteeno
hoosteeno / gist:4660277
Last active December 11, 2015 21:09
Track the remote repository that you forked from. Merge its changes into your local fork.
# where "master" is the branch you care about in the original repository,
# "mozilla" is the local name you will use for this branch,
# and everything after that is the url to the remote repo.
git remote add --track master mozilla git@github.com:mozilla/mozillians.git
# get a local copy of that remote repo
git fetch mozilla
# merge it
git merge mozilla/master
@hoosteeno
hoosteeno / future_dates.py
Last active December 12, 2015 00:58
Output a list of weekly date strings to be used as release numbers in bugzilla
from datetime import date
from datetime import timedelta
launch_day = date(2013, 2, 7)
week = timedelta(days=7)
while (launch_day.year == 2013):
print launch_day.strftime('%Y-%m-%d')
launch_day = launch_day + week
<noinclude>Edit the page to see the template text.</noinclude>
<includeonly>
==Features landing in this release==
<bugzilla>
{
"component": "Phonebook",
"product": "Community Tools",
"target_milestone": "[[Milestone::{{{Milestone}}}|{{{Milestone}}}]]"
}
</bugzilla>
<noinclude>Edit the page to see the form markup.</noinclude>
<includeonly>
{{{info|page name=<Mozillians Release[Milestone]>}}}
<div id="wikiPreview" style="display: none; padding-bottom: 25px; margin-bottom: 25px; border-bottom: 1px solid #AAAAAA;"></div>
{{{for template|Mozillians Release}}}
{| class="formtable"
! Milestone:
| {{{field|Milestone|mandatory|default=2013-02-07|input type=text|size=10}}}
|}
{{{end template}}}