Skip to content

Instantly share code, notes, and snippets.

View gist:fb9521be908297d852d5
.then(function (element) {
console.info("=> found somethining..");
element.click(); // this wrong since we are not returning and the chain goes goes on
}).end()
// better?
.click().then(function(){console.info("=> found somethining..")})
@denov
denov / gist:5c2b858f9a28343a5424
Created Sep 25, 2014
trying to test dijit dropdown
View gist:5c2b858f9a28343a5424
.findByCssSelector('div.recommendationSection.section')
.then(function(section){
section.getAttribute('id')
.then(function(id){
console.info("=> found section ID : " + id);
section.findById(id+'_secOptMenu_label')
.then(function(menu){
console.info("=> Found option menu ");
menu.click();
})
@denov
denov / update-ssh-sg.py
Created Nov 27, 2017
Update SSH ingest rule
View update-ssh-sg.py
import boto3
from urllib2 import urlopen
sg_id = "sg-xxxxxxxx"
sg_desc = "user-name"
old_ip = "127.0.0.1"
current_ip = urlopen("http://ip.42.pl/raw").read()
@denov
denov / uuidv4.ts
Created Oct 26, 2018
typescript function for uuid v4
View uuidv4.ts
export function uuidv4(): string {
return (`${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`).replace(/[018]/g, (c: any) =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
)
}
@denov
denov / themeContext.ts
Created Apr 30, 2019
dojo2 theme injector
View themeContext.ts
import {themeContext} from "./main";
import darkStyle from "./themes/dark";
import lightStyle from "./themes/light";
import defaultStyle from "./themes/default";
import * as defaultColors from "./themes/default/app.m.css";
import * as darkColors from "./themes/dark/app.m.css";
import * as lightColors from "./themes/light/app.m.css";
View Single item from stream
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collector;
import java.util.stream.Collectors;
public class StreamUtils {
public static <T> Collector<T, ?, T> singletonCollector() {
View Cache Config Sample
package org.magic.config;
import org.magic.config.annotation.Aws;
import org.magic.config.annotation.LocalDev;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;