Skip to content

Instantly share code, notes, and snippets.

View chrisronline's full-sized avatar

Chris Roberson chrisronline

View GitHub Profile

This code can probably be rewritten a bit

const name = [];
for (let i = 0; i < res.trails.length; i++){
  name[i] = res.trails[i]['name'].replace(/\s/g, "-").toLowerCase();
}
const nameArray = Object.values(name);
console.log(nameArray);
var fs = require('fs');
fs.readFile(__dirname + '/1426677542365_data.json', function(err, data) {
if (err) throw err;
var json = JSON.parse(data);
console.log('Rows=%d Length=%d', json.length, new Buffer(JSON.stringify(json)).toString('base64').length);
});
require 'json'
class JSONSerializer
def self.deserialize(json, cls)
obj = cls.new()
parsed = JSON.parse(json)
parsed.each do |child|
prop = child[0]
value = child[1]
obj.send("#{prop}=", value)
it('test', function() {
spyOn(dialog, 'dialog').andCallFake(function(opts) {
var options = opts.resolve.options();
expect(options.title).toBe('Error');
expect(options.fields[0]).toBe('name');
expect(options.showRequired).toBe(false);
// If you look at showError, it calls dialog.dialog
// and expects an object returned that has a 'open' method
// so mock that out so the real controller does not
it('test', function() {
spyOn(dialog, 'dialog').andCallFake(function(opts) {
var options = opts.resolve.options();
expect(options.title).toBe('Error');
expect(options.fields[0]).toBe('name');
expect(options.showRequired).toBe(false);
// If you look at showError, it calls dialog.dialog
// and expects an object returned that has a 'open' method
// so mock that out so the real controller does not
'use strict';
angular.module('gigwellApp')
/**
* Wraps a promise call to provide a "singleton" for that promise so attempts to recreate that promise will simply
* reuse the singleton one.
*
* Supports manually purging and also purging based on a configurable TTL (in ms)
*/
.factory('singletonPromise', function($q) {
Index: drupal/sites/all/modules/entityreference/entityreference.module
===================================================================
--- drupal/sites/all/modules/entityreference/entityreference.module (revision 2163)
+++ drupal/sites/all/modules/entityreference/entityreference.module (working copy)
@@ -1030,7 +1030,7 @@
if (isset($tag_last)) {
// Get an array of matching entities.
- $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 10);
+ $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 20);