Skip to content

Instantly share code, notes, and snippets.

View kehh's full-sized avatar

Kehan Harman kehh

View GitHub Profile
@kehh
kehh / fix_ca_locales_en_AU.sql
Created January 20, 2017 06:26
Fix CollectiveAccess locales. Replaces all en_US locales with en_AU. Removes all other locale values.
UPDATE ca_attributes SET locale_id = 1 WHERE locale_id <> 1;
UPDATE ca_data_importer_labels SET locale_id = 1 WHERE locale_id <> 1;
DELETE FROM ca_editor_ui_labels WHERE locale_id <> 1;
DELETE from ca_editor_ui_screen_labels WHERE locale_id <> 1;
UPDATE ca_entities SET locale_id = 1 WHERE locale_id <> 1;
UPDATE ca_entity_labels SET locale_id = 1 WHERE locale_id <> 1;
UPDATE ca_list_item_labels SET locale_id = 1 WHERE locale_id = 13;
DELETE FROM ca_list_item_labels WHERE locale_id <> 1;
DELETE FROM ca_list_labels WHERE locale_id <> 1;
UPDATE ca_loan_labels SET locale_id = 1 WHERE locale_id <> 1;
@kehh
kehh / rebuildHierarchicalIndexes.php
Last active September 5, 2016 02:00
Rebuild CollectiveAccess Hierarchical Indexes
<?php
require_once('setup.php');
require_once(__CA_LIB_DIR__.'/core/Datamodel.php');
set_time_limit(3600*8);
$o_db = new Db();
$t_timer = new Timer();
$o_dm = Datamodel::load();
$va_table_names = $o_dm->getTableNames();
@kehh
kehh / git-update
Last active July 29, 2016 06:00 — forked from leftclickben/git-update
Pull down latest from git remote and remove dead branches
#!/bin/bash
#
# git-update
# Pull down latest from git remote and remove dead branches
#
# To create an alias to `git update`, put this on your path, then:
# git config --global alias.update '!git-update'
#
# Copyright (c) 2016 Leftclick.com.au
# License: MIT
@kehh
kehh / .sshconfig
Last active July 15, 2016 06:50
SSH Configuration makes your life easier - place this file at .ssh/config
# Stop ssh disconnecting
ServerAliveInterval 5
# Use a particular key and user for a group of hosts
Host *.histwest.org.au
IdentityFile ~/aws/keys/rwahs.pem
User ubuntu
{#
/**
* @file
* Theme override to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
@kehh
kehh / mysqlDataReport.sql
Last active August 29, 2015 14:20
MySQL Data Report
-- Report on table data within a database using information_schema to inspect the data
-- copied to https://gist.github.com/kehh/2ef188881002b10e4b3c
USE mecc;
SET @sql = NULL;
-- may need to be bigger depending on how many tables, columns you have and the length of data in those columns
SET @@group_concat_max_len = 500000000;
SELECT GROUP_CONCAT(
CONCAT_WS('',
'SELECT "', TABLE_NAME, '" AS tableName, "',
COLUMN_NAME , '" AS field,
@kehh
kehh / install_opengeo.md
Last active August 29, 2015 14:13
Installation script for opengeo suite installation
<?php
/**
* @file
* Custom Drush integration.
*/
/**
* Implements hook_drush_command().
*
* @return
@kehh
kehh / 002-subdomains.conf
Created November 28, 2014 02:31
wildcard subdomains apache
<Directory /home/kehan/workspace>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
<?php
/**
* Example usage (using jQuery):
* var url = "/path/mantisconnect_json.php?name=mc_project_get_issues&project_id=0&page_number=1&per_page=10";
* $.getJSON(url, function(data) {
* $.each(data, function() {
* console.log(data.id + ': ' data.summary);
* });
* });
*/