Skip to content

Instantly share code, notes, and snippets.

@cstuncsik
cstuncsik / download.js
Created January 27, 2016 08:58
iMacros with javascript (clicking an ajax pager than download the 50 files in the list by opening list item in new tab)
var pages = 50;
var pager = [
'CODE:',
'EVENT TYPE=CLICK SELECTOR="#browsecontent>center>span:nth-of-type(3)"',
'WAIT SECONDS=3'
].join('\n');
var page = [
'CODE:',
@cstuncsik
cstuncsik / pointInPoly.js
Last active March 25, 2016 17:50
Point in polygon
const pointInPoly = (poly, point) => {
let inside = false;
let intersect = false;
let [x, y] = point;
let j = poly.length - 1;
poly.forEach((pp, i) => {
let [xi, yi] = pp;
let [xj, yj] = poly[j];
intersect = ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
if (intersect) {
var curry = function (fn) {
var args = Array.prototype.slice.call(arguments);
// If the curried function has enough arguments to run
// just cut out the first one which is the function itself
// and call it with the rest (all the arguments it needs)
if (args.length - 1 >= fn.length) return fn.apply(this, args.slice(1));
// If there are not enough arguments just return a function waiting for the rest
return function () {
return curry.apply(this, args.concat.apply(args, arguments));
};
var compose = function () {
return Array.prototype.slice.call(arguments).reduce(function (f, g) {
return function () {
return f(g.apply(null, Array.prototype.slice.call(arguments)));
};
});
}
@cstuncsik
cstuncsik / range.js
Created July 21, 2016 04:40
Array range
const range = (from, to) => [for (i of Array(to).keys()) from + i];
@cstuncsik
cstuncsik / useful-git-aliases.sh
Created February 27, 2017 08:34
Useful git aliases
# git please
# checks that your local copy of the ref that you’re overwriting is up-to-date before overwriting it.
# This indicates that you’ve at least fetched the changes you’re about to stomp.
git config --global alias.please 'push --force-with-lease'
# git commend
# quietly tacks any staged files onto the last commit you created, re-using your existing commit message
git config --global alias.commend 'commit --amend --no-edit'
# git it
@cstuncsik
cstuncsik / jenkins-material-theme-cyan.css
Last active April 11, 2017 08:11
Jenkins Material Theme Cyan
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);
@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);
@keyframes a {
0% {
transform: rotate(0deg)
}
to {
transform: rotate(1turn)
}
}
@cstuncsik
cstuncsik / .gitconfig
Created July 11, 2017 04:26 — forked from schmidt1024/.gitconfig
.gitconfig
[color]
status = auto
diff = auto
branch = auto
interactive = auto
ui = true
[alias]
amend = !"git commit --amend -C HEAD"
s = status
a = add -A
@cstuncsik
cstuncsik / Main.elm
Created July 26, 2017 19:46 — forked from anonymous/Main.elm
Buttons
module Main exposing (..)
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main : Program Never Model Msg
main =
Html.beginnerProgram { model = model, view = view, update = update }
@cstuncsik
cstuncsik / Main.elm
Created July 26, 2017 19:51 — forked from anonymous/Main.elm
Text Fields
module Main exposing (..)
import Html exposing (Html, Attribute, div, input, text)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
main : Program Never Model Msg
main =
Html.beginnerProgram { model = model, view = view, update = update }