Skip to content

Instantly share code, notes, and snippets.

View mixmix's full-sized avatar

mix irving mixmix

View GitHub Profile
@mixmix
mixmix / languages.rake
Last active December 23, 2015 17:09
Language updater rake task
# rake languages:update
# Note: requires the gem httparty
# the name of our project on transifex is loomio-1... swap this for your own in the code below
namespace :languages do
task :update => :environment do
@options = { basic_auth: {username: ENV['TRANSIFEX_USERNAME'], password: ENV['TRANSIFEX_PASSWORD']} }
language_info = HTTParty.get('http://www.transifex.com/api/2/project/loomio-1/languages', @options)
languages = language_info.each.map do |l|
@mixmix
mixmix / fractal.rb
Last active August 29, 2015 14:01
run it in terminal... you'll need to zoom out a fair bit
require 'curses'
class ComplexNum
attr_reader :re, :im
def initialize(re: 0, im:0)
@re = re
@im = im
end
@mixmix
mixmix / invoices with multiple payments
Last active August 29, 2015 14:05
This is a collection of Invoices which have more than one payment with the exact same value.
**Invoice 267** 4 payments, sub_total: 1439.08
#635 | $100.0 2013-09-19 12:00:00 +1200 CashPayment
#649 | $100.0 2013-10-22 13:00:00 +1300 CashPayment
#650 | $100.0 2013-11-15 13:00:00 +1300 CashPayment
#709 | $1354.94 2013-10-10 13:00:00 +1300 CashPayment
https://go.xero.com/AccountsReceivable/View.aspx?InvoiceID=3e76f7bc-6e2c-4eac-a577-a2822ba1b841
**Invoice 325** 5 payments, sub_total: 2049.2
#427 | $1500.0 2013-09-26 12:00:00 +1200 CashPayment
#428 | $165.5 2013-11-11 13:00:00 +1300 CashPayment
@mixmix
mixmix / gist:5ede408dae22b603d872
Created September 25, 2014 03:25
run sync_all & log to specific file
subdomain = 'nzdemo1'
Storey.switch subdomain
account = Account.current
owner = account.owner
custom_log_name = "xero-mix-#{subdomain}"
custom_logger = Xero::Logger.new "#{Rails.root}/log/#{custom_log_name}.log"
custom_connection = Xero::Connection.new owner, Xero::ApplicationFactory.new, custom_logger
@mixmix
mixmix / gist:df631fdf16c53787a780
Last active August 29, 2015 14:11
diffs to be sure
.
Storey.switch 'amc'
a = Account.current
suppliers = Supplier.where(account_number: 'BLA') + Supplier.where(account_number: 'HAINES')
supplier_ids = suppliers.map(&:id)
target_parts = Part.where supplier_id: supplier_ids ; p 'got'
parts_in_use = JobPart.select(:part_id).map(&:part_id).uniq
target_parts_in_use = target_parts.select {|p| parts_in_use.include? p.id } ; p 'got'
var pathname = process.argv[2];
var extension = '.' + process.argv[3];
var fs = require('fs');
var path = require('path');
fs.readdir(pathname, function(err, list) {
var matches = list.filter( function(element) {
return path.extname(element) === extension;
});
@mixmix
mixmix / gist:b9573a0bfceea972aeca
Last active August 29, 2015 14:12
refacrotring callbacks
var http = require('http')
var completeCount = 0
var dataStore = []
for (var i=0; i<(process.argv.length-2); i++) {
dataStore[i] = {
url: process.argv[i+2],
response: ''
}
}
@mixmix
mixmix / gist:befb78d56827ce0c8d22
Last active August 29, 2015 14:14
how this board works

What this board is

Cards here are organisation-wide tasks that require Craftworkers attention + input to progress.

This board is:

  • the central ledger for tasks everyone needs to do
  • the place where org meetings are managed
  • for internal facing tasks only

OPEN GOVERNMENT PARTNERSHIP

OS//OS Workshop - New Zealand action plan

Using technology and innovation: #A1. How would you improve transparency and accountability of public services (eg openness about access to information?)? A1/1