This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beforeEach(function() { | |
this.addMatchers({ | |
toContainClass: function (expected) { | |
var self = this; | |
var deferred = protractor.promise.defer(); | |
self.actual.getAttribute('class').then(function(classes) { | |
var result = classes && classes.search(new RegExp(expected, 'i')) > 0; | |
if (result) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "{0} is dead, but {1} is alive! {0} {2}".format("ASP", "ASP.NET") | |
if (!String.prototype.format) { | |
String.prototype.format = function() { | |
var args = arguments; | |
return this.replace(/{(\d+)}/g, function(match, number) { | |
return typeof args[number] != 'undefined' | |
? args[number] | |
: match | |
; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('au.common') | |
.constant('httpStatus', { | |
isInformational: function(code) { | |
return code >= 100 && code <= 199; | |
}, | |
isSuccess: function(code) { | |
return code >= 200 && code <= 299; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'angular', | |
'restangular', | |
'../config' | |
], function (angular) { | |
'use strict'; | |
angular.module('convertiser.common') | |
.service('systemService', function (Restangular) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Angular Fine Uploader | |
* @version 0.1.0 | |
* @homepage https://github.com/darthwade/angular-fine-uploader | |
* @author Vadym Petrychenko https://github.com/darthwade | |
* @license The MIT License (http://www.opensource.org/licenses/mit-license.php) | |
* @copyright 2014 Vadym Petrychenko | |
*/ | |
(function (factory) { | |
if (typeof define === 'function' && define.amd) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.delayed = function (delay) { | |
var timer = 0; | |
var callback = this; | |
return function() { | |
clearTimeout(timer); | |
timer = setTimeout(callback, ms); | |
}; | |
}; | |
document.getElementById('search').addEventListener('keyup',search.delayed(200)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!Element.prototype.getElementsByClassName) { | |
Element.prototype.getElementsByClassName = function (search) { | |
var d = this, elements, pattern, i, results = []; | |
if (d.querySelectorAll) { // IE8 | |
return d.querySelectorAll("." + search); | |
} | |
if (d.evaluate) { // IE6, IE7 | |
pattern = ".//*[contains(concat(' ', @class, ' '), ' " + search + " ')]"; | |
elements = d.evaluate(pattern, d, null, 0, null); | |
while ((i = elements.iterateNext())) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement, fromIndex) { | |
var k; | |
if (this == null) { | |
throw new TypeError('"this" is null or not defined'); | |
} | |
var O = Object(this); | |
var len = O.length >>> 0; | |
if (len === 0) { | |
return -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import os | |
from boto.s3.connection import SubdomainCallingFormat | |
# AWS S3 | |
AWS_S3_ACCESS_KEY_ID = os.getenv('AWS_S3_ACCESS_KEY_ID') | |
AWS_S3_SECRET_ACCESS_KEY = os.getenv('AWS_S3_SECRET_ACCESS_KEY') | |
AWS_S3_BASE_URL = 's3.amazonaws.com' | |
# AWS_S3_FILE_BUFFER_SIZE = 5242880 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> # Grab countries from https://github.com/umpirsky/country-list/blob/master/country/cldr | |
>>> LANG = 'uk' | |
>>> FIELD_SUFFIX = '_uk' | |
>>> DOWNLOAD_URL = 'https://raw.githubusercontent.com/umpirsky/country-list/master/country/cldr/{lang}/country.txt' | |
>>> from urllib2 import urlopen | |
>>> lines = urlopen(DOWNLOAD_URL.format(lang=LANG)).read().split('\n') | |
>>> from apps.gis.models import Country | |
>>> for l in lines: | |
>>> if not len(l): break | |
>>> l = l.decode('utf-8') |
OlderNewer