Skip to content

Instantly share code, notes, and snippets.

View osde8info's full-sized avatar

Clive D osde8info

View GitHub Profile
@vitobotta
vitobotta / Importing posts from Wordpress into Jekyll.rb
Created March 26, 2011 22:50
The script I used to import posts from my Wordpress blog into a new Jekyll one.
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
%w(_posts _drafts images/posts/featured).each{|folder| FileUtils.mkdir_p folder}
@yeroon
yeroon / simpleXmlToArray
Created April 18, 2011 14:45
Converts a simpleXML element into an array. Preserves attributes and everything.
/**
* Converts a simpleXML element into an array. Preserves attributes and everything.
* You can choose to get your elements either flattened, or stored in a custom index that
* you define.
* For example, for a given element
* <field name="someName" type="someType"/>
* if you choose to flatten attributes, you would get:
* $array['field']['name'] = 'someName';
* $array['field']['type'] = 'someType';
* If you choose not to flatten, you get:
@wheresalice
wheresalice / gist:1316337
Created October 26, 2011 13:24
Mysqldump of tables with a prefix
mysql databasename -u [root] -p[password] -e 'show tables like "wp_153_%"' | grep -v Tables_in
| xargs mysqldump [databasename] -u [root] -p[password] > [target_file]
@trey
trey / happy_git_on_osx.md
Last active February 18, 2024 10:46
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@sbob-sfdc
sbob-sfdc / MobileInventory.page
Created September 2, 2012 23:52
Workshop 202, Tutorial 3, Step 4, Visualforce
<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Merchandise__c" extensions="MobileInventoryExtension" recordSetVar="products">
<!-- stylesheets and scripts, from CDN (use local files in production) -->
<apex:stylesheet value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js"/>
<apex:includeScript value="https://ajax.aspnetcdn.com/ajax/jquery.mobile/1.1.0/jquery.mobile-1.1.0.min.js"/>
<head>
<title>Mobile Inventory</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script>
@sbob-sfdc
sbob-sfdc / index.html
Created September 5, 2012 20:46
Workshop 302, Tutorial 2, Step 2
<!-- Main page, to display list of Merchandise once app starts -->
<div data-role="page" data-theme="b" id="mainpage">
<!-- page header -->
<div data-role="header">
<!-- button for logging out -->
<a href='#' id="link_logout" data-role="button" data-icon='delete'>
Log Out
</a>
<!-- page title -->
<h2>List</h2>
@sbob-sfdc
sbob-sfdc / inline.js
Created September 5, 2012 20:47
Workshop 302, Tutorial 3, Step 3.1
// handle successful retrieval of Merchandise records
function onSuccessSfdcMerchandise(response) {
// avoid jQuery conflicts
var $j = jQuery.noConflict();
// debug info to console
SFHybridApp.logToConsole("onSuccessSfdcMerchandise: received " + response.totalSize + " merchandise records");
// clear div_merchandise_list HTML
$j("#div_merchandise_list").html("");
@sbob-sfdc
sbob-sfdc / index.html
Created September 5, 2012 20:49
Workshop 302, Tutorial 3, Step 1
<!-- Detail page, to display details when user clicks specific Merchandise record -->
<div data-role="page" data-theme="b" id="detailpage">
<!-- page header -->
<div data-role="header">
<!-- button for going back to mainpage -->
<a href='#mainpage' id="backInventory" class='ui-btn-left' data-icon='home'>
Home
</a>
<!-- page title -->
<h1>Edit</h1>
@sbob-sfdc
sbob-sfdc / inline.js
Created September 5, 2012 20:50
Workshop 302, Tutorial 3, Step 2
// handle clicks to Update on detailpage
$j("#updateButton").click(function() {
// update local information in the inventory array
inventory[$j("#detailpage").attr("data-id")].Quantity__c = $j("#quantity").val();
currentRecord = inventory[$j("#detailpage").attr("data-id")];
// strip out ID before updating the database
var data = new Object();
data.Quantity__c = currentRecord.Quantity__c;
// update the database
@pklaus
pklaus / remove-orphaned-raw-images.py
Last active May 8, 2023 20:43
Do you own a DSLR? If so, do you transfer your images to your computer, then look at the JPEGs and delete the crappy ones? If you do, your RAW images may be leftover. This Python script helps you cleaning up your image folders after deleting unwanted JPEGs. See http://blog.philippklaus.de/2012/12/cleaning-leftover-raw-images-after-selecting-imag…
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
This script was moved to
https://github.com/pklaus/pklaus/blob/master/pklaus/images/orphans/remove.py
Here's the original content left for you as a reference:
Do you own a DSLR? If so, do you transfer your images to your computer,
then look at the JPEGs and delete the crappy ones? If you do, your RAW