Skip to content

Instantly share code, notes, and snippets.

View gdpelican's full-sized avatar

James Kiesel gdpelican

  • Wellington, New Zealand
View GitHub Profile
import json
import requests
import os
import ast
import logging
import sys
import boto3
import datetime
import time
import uuid
running = false
$rootScope.$watch ->
return if running
running = true
console.time('digestLoop')
$rootScope.$$postDigest ->
console.timeEnd('digestLoop')
running = false
@gdpelican
gdpelican / loomio-angular-2.md
Last active September 20, 2016 10:21
Loomio migration to angular 2

Migration to 1.5

  • Upgrading 'directives' to components doesn't seem too hard, but is tedious and error-prone
    • Need to update all references to the inherent scope (so %div{model: 'thread'} needs to become %div{model: '$ctrl.thread'})
    • We can also rename '$ctrl' with the controllerAs option when creating the components
    • This has the benefit of allowing (small parts of) our views to port over to angular 2 (more on that later). However, in my view the views will still require a substantial rewrite on top of this, because the syntax from 1 -> 2 is so different

Migration to 2.0

  • Dependency support for angular 2:
Running "spec-e2e" task
Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
FFFFFFFFFFFFFF
Failures:
1) Discussion Page add a comment
Message:
timeout: timed out after 30000 msec waiting for spec to complete
@gdpelican
gdpelican / url_parser.js
Created March 13, 2015 01:30
A rudimentary URL parser in javascript.
var route = function(format) {
var splitIntoParts = function(url) {
var urlString = url.match(/^[^\?]*/) || [""]
return urlString[0].split('/');
};
var formatParts = splitIntoParts(format); // Split the format into parts for easy reuse
var splitIntoQueryParams = function(url) {
var paramString = url.match(/\?.*$/) || [""];
@gdpelican
gdpelican / topics_bulk_action_spec.rb
Created December 6, 2014 20:41
Test which fails when Uncategorized category is not yet created [Discourse]
context "when the category is being set to 'Uncategorized'" do
it "changes the category and returns the topic_id" do
topic.update category: category
tba = TopicsBulkAction.new(topic.user, [topic.id], type: 'change_category', category_id: 0)
topic_ids = tba.perform!
topic_ids.should == [topic.id]
topic.reload
topic.category.name.should == 'Uncategorized'
end
end