Skip to content

Instantly share code, notes, and snippets.

View mkoryak's full-sized avatar
🐈
Working

Misha Koryak mkoryak

🐈
Working
View GitHub Profile
@mkoryak
mkoryak / moplogger.js
Created July 7, 2021 14:20 — forked from bathos/moplogger.js
moplogger.js
// This is useful for a few things:
//
// 1. Checking what dictionary options are supported by some platform API.
// 2. Debugging mysterious cases where an object you pass as input to another
// API doesn’t seem to get treated the way you’re expecting.
// 3. When designing another Proxy’s handler implementation, verifying that you
// are accounting for everything correctly and that the intended abstraction
// isn’t leaking in quirky ways.
//
// ex:
@m-radzikowski
m-radzikowski / script-template.sh
Last active July 13, 2024 13:20
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@bathos
bathos / clippen-majik.js
Created May 24, 2017 02:46
clippen-majik.js
document.querySelectorAll('canvas')[1].getContext('2d').drawImage = function(canvas) {
const downloadButton = document.getElementById('download');
const anchor = document.createElement('a');
anchor.download = 'poop.png';
anchor.innerText = 'POOP';
anchor.setAttribute('class', downloadButton.getAttribute('class'));
downloadButton.parentElement.replaceChild(anchor, downloadButton);
{
"plugins": [
"stylelint-order"
],
"extends": "stylelint-config-standard",
"rules": {
"indentation": 4,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always",
"function-parentheses-newline-inside": "always-multi-line",
@reebalazs
reebalazs / karma-spec.js
Last active August 29, 2015 14:07
Karma unit testing AngularJS submodules with config(), run()
// DRAFT, UNTESTED
// Originally you have an Angular app that
// is decomposed to submodules. Each submodule has its own
// config and run handlers. One submodule (lib3)
// also depends on another submodule.
module('myapp', ['lib1', 'lib2', 'lib3'])
.config(...)
@mkoryak
mkoryak / _deferred_shim.js
Created November 13, 2012 16:24
easy to use deferred shim
//requires jQuery.Deferred
_deferred = (function(){
var that = {};
var deferred = {};
var lazy = function(name) {
if(!deferred[name]){
deferred[name] = $.Deferred();
}
return deferred[name];
@xcambar
xcambar / LICENSE
Last active November 20, 2015 12:57
Authenticated routing using AngularJS
Copyright (c) 2015 - Xavier Cambar <@ xcambar_gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@trdarr
trdarr / cps.js
Created October 11, 2012 06:26
"Thunks, Trampolines, and Continuation Passing" in JavaScript
/* "Thunks, Trampolines, and Continuation Passing"
* Python implementation from http://jtauber.com/blog/2008/03/30/
* JavaScript implementation by Thomas Darr <me@trdarr.com>.
*/
// thunk = lambda name: lambda *args: lambda: name(*args)
var thunk = function thunk(fn) {
return function _thunk() {
var splat = Array.prototype.slice.apply(arguments);
return function __thunk() { return fn.apply(this, splat); };
asdf