Skip to content

Instantly share code, notes, and snippets.

@danbruder
danbruder / migration_add_metadata_to_orders.sql
Created February 15, 2019 16:23
Store JSON blob in Postgres with Diesel
ALTER TABLE orders
ADD COLUMN meta_data jsonb;

Keybase proof

I hereby claim:

  • I am danbruder on github.
  • I am danbruder (https://keybase.io/danbruder) on keybase.
  • I have a public key whose fingerprint is F9BC 547A 06E0 C1AB 182E A30B 26BD 915D EA14 63B5

To claim this, I am signing this object:

@danbruder
danbruder / selenium-install.sh
Last active August 29, 2015 14:13
Install Selenium Server on OSX
#!/bin/sh
run () {
RELEASE="2.44"
PREFIX="/usr/local/lib"
JAR_URL="http://selenium-release.storage.googleapis.com/${RELEASE}/selenium-server-standalone-${RELEASE}.0.jar"
PLIST_URL="https://gist.githubusercontent.com/danbruder/f64930d278d999a0d0e7/raw/4b9792774a4d91b22745b6679a42677bded153d3/selenium.plist"
# Unload running process
if launchctl list | grep -q "selenium"; then
@danbruder
danbruder / full.php
Last active December 22, 2015 07:28
Programmatically adding a field collection item to a node
<?php
function my_function_name_add_image_to_field_collection($nid, $fid){
// Load target node
$node = node_load($nid);
// Create a new field collection
$field_collection_item = entity_create('field_collection_item', array('field_name' => 'my_field_collection_item_name'));
// Prepare link field
$link = array(
<?php
$results = db_select("old_table", "w")
->fields('w')
->execute();