Skip to content

Instantly share code, notes, and snippets.

View guncha's full-sized avatar

Guntars Ašmanis-Graham guncha

View GitHub Profile
@ithinkihaveacat
ithinkihaveacat / service-worker.d.ts
Last active September 30, 2024 00:18 — forked from tiernan/service-worker.d.ts
Typings for using the Service Worker API with TypeScript
/**
* Copyright (c) 2016, Tiernan Cridland
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby
* granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
@mfazekas
mfazekas / gist:cc7792802859d91e3fcb
Last active June 24, 2016 09:53
Monkey patch for fixing infinite loop in autosave_association
# fixes 'https://github.com/rails/rails/pull/16640'
# add this to lib/patches/active_record/autosave_association.rb
# then in config/environment.rb before initialize! load this file with
# something like:
# require File.join(File.dirname(__FILE__), '../lib/patches/active_record/autosave_association.rb')
# see https://gist.github.com/mfazekas/cc7792802859d91e3fcb
require 'active_record/autosave_association'
module ActiveRecord
@bemasher
bemasher / stack.go
Last active August 19, 2020 10:59
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}
@masak
masak / ramble.md
Created January 1, 2012 19:02
I'm thinking about macros again

Macros and closures are a bit alike. Here's I'll try to nail down one of their differences.

Closures

A closure is a function which carries with it a lexical environment. The returned block below, for example, carries around the lexical environment containing the variable $counter:

sub create-counter(Int $start-value) {
    my Int $counter = $start-value;
    return { $counter++ };

}

@justjkk
justjkk / LICENSE
Last active April 7, 2024 16:57
Parsing JSON with lex and yacc
The MIT License (MIT)
Copyright (c) 2015 J Kishore Kumar
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: