Skip to content

Instantly share code, notes, and snippets.

View andrewmelis's full-sized avatar

Andrew Melis andrewmelis

  • 13:55 - 4h behind
View GitHub Profile
@flx42
flx42 / test.sh
Created June 13, 2018 03:00
--cache-from issue with config.Cmd
#!/bin/bash
set -eux
docker rmi cache test || true
docker build -t cache --label "ref=12345" - <<EOF
FROM alpine
ENV VAR value
EOF
@Integralist
Integralist / 1. Sumo Filter Explanation.md
Last active July 19, 2022 14:10
Demonstrates how to use Sumo Logic query language

Take log message and parse as JSON (create new column jsonobj):

parse "*" as jsonobj

Take new jsonobj column and create a new column for the specified key in the JSON:

json field=jsonobj "my-obj-key"
@akgupta
akgupta / quotaexceeded.js
Created March 17, 2012 22:12
handle quota exceeded error in local storage
try {
module.$localStorage[key] = serializer(value);
} catch(e) {
if(e.name === 'QUOTA_EXCEEDED_ERR') {
// reset to make space
module.reset();
module.$localStorage[key] = serializer(value);
} else {
module.localStorageAvailable = false;
$log.error("Local storage write failure - " + e);
@akgupta
akgupta / localStorageSync.js
Created March 12, 2012 04:20
Overriding backbone sync to use local storage
// overriding sync to use local storage when possible
sync : function(method, model, options){
var key, now, timestamp, refresh;
if(method === 'read' && this.constants.isStoredInLocalStorage) {
// only override sync if it is a fetch('read') request
key = this.getKey();
if(key) {
now = new Date().getTime();
timestamp = $storage.get(key + ":timestamp");
refresh = options.forceRefresh;