Skip to content

Instantly share code, notes, and snippets.

@denov
denov / themeContext.ts
Created April 30, 2019 00:59
dojo2 theme injector
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";
@denov
denov / uuidv4.ts
Created October 26, 2018 21:42
typescript function for uuid v4
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 / update-ssh-sg.py
Created November 27, 2017 00:56
Update SSH ingest rule
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()
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;
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() {
.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 September 25, 2014 21:24
trying to test dijit dropdown
.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();
})