Skip to content

Instantly share code, notes, and snippets.

View szkrd's full-sized avatar

szabolcs kurdi szkrd

  • tralfamadore
View GitHub Profile
@szkrd
szkrd / search_files.js
Created April 20, 2013 15:49
search for files in a folder (rhino + swing gui)
// launcher:
//#!/bin/bash
//export CLASSPATH=$CLASSPATH:~/libs/js.jar:~/libs/swt.jar
//cd ~/bin/searchfiles/
//java org.mozilla.javascript.tools.shell.Main -version 170 search_files.js $@
importPackage(java.io);
importPackage(java.lang);
var swt = JavaImporter(
org.eclipse.swt.SWT,
@szkrd
szkrd / commit-msg_lite.sh
Created July 16, 2014 13:42
git commit message hook lite
#!/bin/sh
# halp!!4
if [ $# -eq 0 ] || [ $1 == "--help" ] || [ $1 == "-h" ] || [ $1 == "/?" ]; then
echo "check ticket offline, using regexp; usage:"
echo "script (-v) [filename]"
echo "-v = verbose, optional; dumps messages, not just the exit codes"
echo "filename = name of the file containing the commit message, required"
exit 0
fi
@szkrd
szkrd / commit-msg.sh
Created July 16, 2014 13:42
git commit message hook with ticket check
#!/bin/sh
# halp!!4
if [ $# -eq 0 ] || [ $1 == "--help" ] || [ $1 == "-h" ] || [ $1 == "/?" ]; then
echo "check ticket online, pinging jira; usage:"
echo "script (-v) [filename]"
echo "-v = verbose, optional; dumps messages, not just the exit codes"
echo "filename = name of the file containing the commit message, required"
exit 0
fi
@szkrd
szkrd / conky.conf
Last active July 14, 2017 11:39
new style conky rc in .config/conky/conky.conf
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
https://wiki.archlinux.org/index.php/conky
$ mkdir -p ~/.config/conky
$ conky -C > ~/.config/conky/conky.conf
]]
conky.config = {
@szkrd
szkrd / private.xml
Last active August 29, 2015 14:24
karabiner Hungarian
<?xml version="1.0"?>
<root>
<!--
do not forget to flip the right command with the right alt:
Command_R to Option_R
Option_R to Command_R
-->
<vkchangeinputsourcedef>
<name>KeyCode::VK_CHANGE_INPUTSOURCE_TO_EN_US</name>
<inputsourceid_equal>com.apple.keylayout.US</inputsourceid_equal>
'use strict'
var int = require('int')
function hexToDec (s) {
const map = '0123456789abcdef'
let power = 0
let res = 0
for (let i = s.length - 1; i >= 0; i--) {
const currentDigit = s.substr(i, 1)
@szkrd
szkrd / testutils.js
Last active June 27, 2016 15:38
deep fuzzy equality and deep sorting
function _selectProp (obj, props) {
if (typeof props === 'string') {
return props
}
if (_.isArray(obj) && obj.length) {
obj = obj[0]
}
for (let i = 0, l = props.length; i < l; i++) {
if (_.keys(obj).indexOf(props[i]) > -1) {
return props[i]
@szkrd
szkrd / blogger_xml_to_markdown.js
Created June 12, 2016 17:33
Create md files from blogger posts
// import from blogger-XX-XX-XXXX.xml
// deps:
/*
"dedent": "0.6.0",
"diacritics": "1.2.3",
"html-entities": "1.2.0",
"lodash": "4.0.1",
"marked": "0.3.5",
"sanitize-filename": "1.5.3",
@szkrd
szkrd / mocha_jsdom_setup.js
Created June 27, 2016 15:37
babel + mocha + chai + sinon + jsdom + hacked require + browser window objects
/*eslint no-console: 0*/
// mocha unit tests setup, no e2e, probably no integ!
require('babel-core/register');
require('babel-polyfill');
const jsdom = require('jsdom');
const sinon = require('sinon');
const chai = require('chai');
const sinonChai = require('sinon-chai');
// use sinon with bdd
@szkrd
szkrd / click-outside.directive.js
Created August 29, 2016 15:31
vuejs click outside element directive
export default {
bind() {
let click = this.click = e => {
let target = e.target;
let opacity = parseInt((window.getComputedStyle(this.el, null) || {}).opacity, 10) || 0;
let hidden = this.el.style.display === 'none';
if (opacity === 0 || hidden) {
return;
}
let boundFn = this.vm[this.expression];