Skip to content

Instantly share code, notes, and snippets.

View zkat's full-sized avatar
💭
Rusting it up

Kat Marchán zkat

💭
Rusting it up
View GitHub Profile
@zkat
zkat / gist:1930f5b34e2aae56b82c
Last active August 29, 2015 14:06
playing around with auto-filtered/mapped `can.List`
function test() {
var sourceList = new can.List();
var stream = sourceList.filteredStream(function(todo, map) {
if (!todo.attr("done")) {
todo.attr("steps").forEach(map);
}
});
var targetList = stream.toList();
sourceList.push({
;;;
;;; Git utils
;;;
(require 'vc-git nil t)
(defcustom git-grep-switches "-E -I -nH -i --no-color"
"Switches to pass to `git grep'."
:type 'string)
(defun git-grep (regexp)
@zkat
zkat / logloc.js
Last active August 29, 2015 14:00
Log logger locations globally
var old = {};
module.exports = {
install: install,
uninstall: uninstall,
methods: ["log", "info", "warn", "error"]
};
install();
@zkat
zkat / canjs-browserified.js
Last active August 29, 2015 13:56
CanJS browserify artifact generated from amd version
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var can=require("can/util/library.js"),ThIsIsToTaLlYbeCaUsEiMlAzY=require("can/control/route.js"),ThIsIsToTaLlYbeCaUsEiMlAzY=require("can/model.js"),ThIsIsToTaLlYbeCaUsEiMlAzY=require("can/view/mustache.js"),ThIsIsToTaLlYbeCaUsEiMlAzY=require("can/component.js");module.exports=can;
},{"can/component.js":3,"can/control/route.js":7,"can/model.js":10,"can/util/library.js":20,"can/view/mustache.js":27}],2:[function(require,module,exports){
/*!
* jQuery JavaScript Library v2.1.0
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
@zkat
zkat / INSTALL.md
Created February 21, 2014 02:36 — forked from namuol/INSTALL.md

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@zkat
zkat / gist:8175523
Last active January 1, 2016 17:09
Solution for http://codecombat.com/play/level/gridmancer Relatively simple solution that solves the problem with 33 rectangles. Most of the code is spent handling an alternate grid that makes it easier to reason about tiles.
var tileSize = 4;
var makeGrid = function() {
var grid = [],
navGrid = this.getNavGrid().grid,
height = ~~(navGrid.length / tileSize),
width = ~~(navGrid[0].length / tileSize);
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++) {
grid[y] = grid[y] || [];
@zkat
zkat / domEqual.js
Last active December 26, 2015 08:39
Example dom comparison utility useful for testing
function domEqual(tree, expected, opts) {
function htmlNormalize(str) {
return str.replace(/\s+/gm, " ")
.replace(/>\s/gm, ">")
.replace(/\s</gm, "<");
}
tree = $(tree);
expected = $(expected);
opts = opts || {};
let treeHtml = tree[0].outerHTML,
@zkat
zkat / gist:7049182
Last active December 25, 2015 22:19
// Inspired by https://twitter.com/nelhage/status/391265023357513728
function timeoutSort(array) {
var deferred = $.Deferred(),
res = [];
array.forEach(function(x) {
setTimeout(function() {
if (res.push(x) == array.length) {
deferred.resolve(res);
};
}, x + 15);
@zkat
zkat / .XCompose
Last active December 1, 2023 03:05
# Compose key characters
# Default
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
# Silly
<Multi_key> <colon> <parenright> : "( ´∀`)" U263A
<Multi_key> <less> <minus> : "←" U2190
<Multi_key> <minus> <greater> : "→" U2192
<Multi_key> <less> <greater> <minus> : "↔"
@zkat
zkat / gist:6479574
Last active December 22, 2015 13:29
  1. Navigate to your repository
  2. $ git remote update
  3. $ git checkout -b <"bugfix" or "feature">/<name> origin/develop
  4. Craft your amazing work of art with your favorite IDE/text editor.
  5. Type make and make sure the application builds successfully.
  6. $ git add <file or files that you changed>
  7. $ git commit -m "#<problemid> - <short text description>"
  8. $ git push -u origin HEAD
  9. ...process for asking branch to be merged...