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
#!/bin/bash | |
function make_image_dir () { | |
TARGET_DIR=$1 | |
if [ ! -d "${TARGET_DIR}" ]; then | |
mkdir "${TARGET_DIR}" | |
fi | |
} | |
function ignore_image_dir () { |
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
app.config(function(RestangularProvider) { | |
// First let's set listTypeIsArray to false, as we have the array wrapped in some other object. | |
RestangularProvider.setListTypeIsArray(false); | |
// Now let's configure the response extractor for each request | |
RestangularProvider.setResponseExtractor(function(response, operation, what, url) { | |
var newResponse; | |
// This is a get for a list | |
if (operation === "getList") { | |
// First the newResponse will be response.objects which is actually an array |
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('keeniolab', ['ngResource']). | |
factory('KeenIO',function ($resource) { | |
var KeenIO = $resource('https://api.keen.io/3.0/projects/513a76812975164a4a000002/queries/:type', | |
{ | |
api_key: 'api-key', | |
event_collection: 'read', | |
timezone: 7200 | |
}, { | |
update: { method: 'PUT' } |
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
FastMutex.prototype.runInLock = function (callback, opt_context) { | |
this._setX() | |
if (!this._isLockAvailable()) { | |
this._retry(callback, opt_context) | |
return | |
} | |
this._setY() |
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
const fetch = (url, params) => ({ | |
type: 'FETCH', | |
url, | |
params, | |
}); | |
const fetchMiddleware = fetchImplementation => store => next => action => { | |
if (action.type === 'FETCH') { | |
const { url, params } = action; | |
const token = store.getState().token; |
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
{ | |
"settings": { | |
"index": { | |
"analysis": { | |
"char_filter": { | |
"ignore_chars": { | |
"type": "mapping", | |
"mappings": [ | |
"'=>", | |
"\u2019=>", |
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
q = { | |
"query": { | |
"function_score": { | |
"boost_mode": "replace", | |
"query": { | |
"ids": { | |
"values": [ | |
50, | |
80, | |
44, |
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'; | |
var KEYS = { | |
enter: 13, | |
left: 37, | |
right: 39, | |
escape: 27, | |
backspace: 8, | |
comma: 188, | |
shift: 16, |
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
# Monkey patch Decimal's default Context to allow | |
# inexact and rounded representation of floats | |
import decimal | |
from boto.dynamodb.types import DYNAMODB_CONTEXT | |
# Inhibit Inexact Exceptions | |
DYNAMODB_CONTEXT.traps[decimal.Inexact] = 0 | |
# Inhibit Rounded Exceptions | |
DYNAMODB_CONTEXT.traps[decimal.Rounded] = 0 |
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
import requests | |
import shutil | |
import os | |
def download_images(url_filename, out_directory, max_urls=None): | |
"""Download images from a file containing URLS. | |
The URL file must contain a single URL per line. | |
Args: |
OlderNewer