Skip to content

Instantly share code, notes, and snippets.

View jimlambie's full-sized avatar
🐙

James Lambie jimlambie

🐙
  • Dunedin, New Zealand
  • 07:12 (UTC +12:00)
View GitHub Profile
@jimlambie
jimlambie / postgres
Created November 3, 2013 23:07
Postgres Import/Export
# export to CSV file
psql -d <database> -c "COPY (SELECT * FROM <table_name>) TO '/full/path/to.csv' WITH CSV"
# import from CSV
psql -d <database> -c "COPY <table_name> FROM '/full/path/to.csv' DELIMITER ',' CSV"
# import SQL file
psql -d <database> -f <filename>
@jimlambie
jimlambie / RefineryCMS
Created November 4, 2013 00:19
RefineryCMS Snippets
# Creating an engine, RefineryCMS 2.0.9
rails generate refinery:engine home_image title:string description:text image:image
@jimlambie
jimlambie / Gemfile
Last active December 29, 2015 04:59
Gemfile for Niche Providers applications
source "https://rubygems.org"
#ruby "1.9.3"
gem "rails", "3.2.14"
gem "pg"
gem "unicorn"
group :development do
gem "heroku_san"
find . -name \.AppleDouble -exec rm -rf {} \;
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
cache = Dalli::Client.new
cache.flush
@jimlambie
jimlambie / create_branch_from_tag
Created April 19, 2016 15:45 — forked from nickfloyd/create_branch_from_tag
To create a branch from a tag
-Go to the starting point of the project
>> git checkout origin master
-fetch all objects
>> git fetch origin
-Make the branch from the tag
>> git branch new_branch tag_name
-Checkout the branch
>> git checkout new_branch
-Push the branch up
>> git push origin new_branch
@jimlambie
jimlambie / kirby.js
Created August 16, 2017 13:32
KirbyProvider for DADI Web
'use strict'
const _ = require('underscore')
const fs = require('fs')
const path = require('path')
const readDir = require('readdir')
const templateStore = require(path.join(__dirname, '/../templates/store'))
const walk = require('walkdir')
const visiblePageRe = /^\d+-/
@jimlambie
jimlambie / pyncheon-migrator.js
Last active October 12, 2017 08:22
Pyncheon to Publish Migration Script
#! /usr/bin/node
const fs = require('fs')
const path = require('path')
const args = process.argv
if (!args && args[2]) {
process.exit(1)
}

0x0078E498b87A1E683A7A7CdF5E4EDfEb463dA763