Skip to content

Instantly share code, notes, and snippets.

View matjaz's full-sized avatar
:octocat:

Matjaž Lipuš matjaz

:octocat:
View GitHub Profile
@matjaz
matjaz / runReturn
Created December 30, 2009 14:59 — forked from remy/runReturn
// because I just needed the function to run once, then assign it -
// I knew that I'd never need to run it manually again, so here I
// extended the Function prototype :)
Function.prototype.runReturn = function (scope) {
this.call(scope);
return this;
};
// for example:
@matjaz
matjaz / Bank@net auto complete username.js
Created October 30, 2010 10:43
Bank@net autocompletes username and focuses password
javascript:if(location.href.indexOf('/bankanet.nkbm.si/')<0){location.href = 'https://bankanet.nkbm.si/bnk/';}else{$("#user").val("username");$("#pass").focus();}
<html>
<head>
<title>Canvas bootstrap</title>
<style>body { text-align: center; } canvas { border: 1px solid black; margin: auto;}</style>
<script src="raf.js"></script>
</head>
<body>
<canvas id="canvas" width="500" height="500"></canvas>
<script>
var helpers = {
@matjaz
matjaz / run.coffee
Created August 13, 2012 17:02
Run coffee script directly without globally installed coffee command
#!/usr/bin/env node
coffee=require('coffee-script');fs=require('fs');coffee.run(fs.readFileSync(__filename, 'utf-8').slice(136, -2));
/*
console.log i for i in [3..1]
console.log 'Lift off!'
*/
@matjaz
matjaz / wat.js
Created December 6, 2012 10:23
What does "this.hello = this.hello;" do?
function O1() {
}
function O2() {
// what does this line do?
this.hello = this.hello;
}
O1.prototype.hello = O2.prototype.hello = function() {
console.log('hello');

Keybase proof

I hereby claim:

  • I am matjaz on github.
  • I am matjaz (https://keybase.io/matjaz) on keybase.
  • I have a public key whose fingerprint is 0E00 29F3 0192 63EF 403F 36E2 D963 34F2 E044 D032

To claim this, I am signing this object:

@matjaz
matjaz / bezahlcode bookmarklet
Last active August 29, 2015 14:04
http://www.bezahlcode.de autofill bank SEPA form
// http://www.bezahlcode.de
(function() {
var parseBezahlCode = function(uri) {
if (uri.slice(0, 25) === 'bank://singlepaymentsepa?') {
var data = {};
var parts = uri.slice(25).split('&');
for (var i = 0, len = parts.length; i < len; i++) {
var prop = parts[i].split('=');
data[decodeURIComponent(prop[0])] = decodeURIComponent(prop[1]);
}
import {autoinject, inject} from './decorators'
class Greeter {
welcome(name): string {
return `Welcome ${name}!`;
}
}
@autoinject // used for constructor DI
export class App {
# Tic-Tac-Toe
## Game logic
Tic-Tac-Toe is a classic game played by two players, "X" and "O", who take turns marking their letter on a 3x3 grid. The first player to mark 3 adjacent cells in a line wins. The game can potentially result in a draw, where all grid cells are marked, but neither player has 3 adjacent cells. To build this game in Eve, we need several parts:
- A game board with cells
- A way to mark a cell as "X" or "O"
- A way to recognize that a player has won the game.
// Menu: Emoji
// Shortcut:
// Twitter: @vjthlk
// Author: Vojta Holik
/** @type {import("@johnlindquist/kit")} */
import "@johnlindquist/kit";
const { emojis, write } = await db("emojis-db", {