Skip to content

Instantly share code, notes, and snippets.

View szkrd's full-sized avatar

szabolcs kurdi szkrd

  • tralfamadore
View GitHub Profile
@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 / 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>
@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,
'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 / 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 / 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 / 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];
@szkrd
szkrd / private.xml
Created September 16, 2016 08:40
Karabiner home (hungarian layout, two keyboards: logitech pc hu vs default air hu)
<?xml version="1.0"?>
<root>
<item>
<name>Hun2Hun q \</name>
<identifier>private.right_option_q_to_backslash</identifier>
<autogen>
__KeyToKey__
KeyCode::Q, ModifierFlag::OPTION_R,
KeyCode::MINUS, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION
</autogen>
@szkrd
szkrd / mod-rewrite-test.js
Created September 20, 2016 15:20
Testing webpack devserver rewrite rules is a pain in the back.
/*
{
"name": "mod-rewrite-test",
"version": "0.0.1",
"main": "index.js",
"scripts": { "dev": "nodemon .", "start": "node ." },
"dependencies": { "connect-modrewrite": "^0.9.0", "express": "^4.14.0" },
"devDependencies": { "nodemon": "^1.9.2" }
}
*/
@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