Skip to content

Instantly share code, notes, and snippets.

@adufilie
adufilie / dictionary.js
Created October 29, 2013 22:50
JavaScript Dictionary
Dictionary = (function(){
// http://github.com/adufilie
function Dictionary() {
this.set = set;
this.get = get;
Object.defineProperty(
this,
"primitives",
{
configurable: false,
@adufilie
adufilie / JavaScript.as
Last active August 29, 2015 13:56
A more reliable alternative to flash.external.ExternalInterface.
/* ***** BEGIN LICENSE BLOCK *****
*
* This file is part of Weave.
*
* The Initial Developer of Weave is the Institute for Visualization
* and Perception Research at the University of Massachusetts Lowell.
* Portions created by the Initial Developer are Copyright (C) 2008-2015
* the Initial Developer. All Rights Reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
@adufilie
adufilie / userContent.css
Last active August 29, 2015 13:57
Make toggl.com less frustrating by showing the invisible buttons.
/*
* Make toggl.com less frustrating by showing the invisible buttons.
*
* Put this file at the following location, then restart FireFox:
* C:\Users\????????\AppData\Roaming\Mozilla\Firefox\Profiles\????????.default\chrome\userContent.css
* See this article for an explanation:
* http://ffeathers.wordpress.com/2013/03/10/how-to-override-css-stylesheets-in-firefox/
*/
@-moz-document domain(toggl.com)
{
@adufilie
adufilie / userContent.css
Last active April 23, 2016 02:50
Make Slack.com suck less on Windows
/*
* Put this file at the following location, then restart FireFox:
* C:\Users\????????\AppData\Roaming\Mozilla\Firefox\Profiles\????????.default\chrome\userContent.css
* See this article for an explanation:
* http://ffeathers.wordpress.com/2013/03/10/how-to-override-css-stylesheets-in-firefox/
*/
@-moz-document domain(slack.com)
{
* {
@adufilie
adufilie / git-merge-revert-salvage.txt
Last active April 15, 2016 18:24
Reverting a bad merge and salvaging the files that were correct
$ git checkout develop
$ git log --merges
commit 35ecc98fc82ef812ace78ea03fec5cbe49e74c54
Merge: 4b55b79 a921fbc
Author: foobar <foo@bar.com>
Date: Thu Apr 14 17:45:54 2016 -0400
Merge branch 'develop' of https://github.com/WeaveTeam/WeaveJS into develop
@adufilie
adufilie / digest_overview_jabber.ftl
Created May 16, 2016 18:04
YouTrack -> Slack notification readability fix
<#ftl attributes={"description":"Overview of the issue update in jabber notification"}>
<#escape x as x?html>
<p>
<#assign priority = issue.Priority>
<#assign isShowStopper = (!priority?is_enumerable && priority == "Show-stopper")>
<#if change.hasEvent("CREATED")>
<#if (!priority?is_enumerable && priority == "Show-stopper")>
<@l10n>${issue.reporter.getVisibleName()} created show-stopper:</@l10n>
<#else>
<@l10n>${issue.reporter.getVisibleName()} created new issue:</@l10n>
@adufilie
adufilie / Flash Builder.icls
Last active July 7, 2016 19:21
Flash Builder theme for IntelliJ IDEA
<scheme name="Flash Builder" version="142" parent_scheme="Default">
<option name="LINE_SPACING" value="1.0" />
<option name="EDITOR_FONT_SIZE" value="13" />
<option name="CONSOLE_FONT_NAME" value="Monospaced" />
<option name="CONSOLE_FONT_SIZE" value="12" />
<option name="EDITOR_FONT_NAME" value="Monospaced" />
<attributes>
<option name="DEFAULT_BLOCK_COMMENT">
<value>
<option name="FOREGROUND" value="9900" />
@adufilie
adufilie / weave-script-list-tables-backwards-compatible.js
Created August 12, 2016 14:46
WeaveFlash script for listing tables used by current visualization
import 'weave.data.AttributeColumns.ReferencedColumn';
import 'weave.api.data.ColumnMetadata';
import 'weave.utils.ColumnUtils';
import 'weave.data.DataSources.WeaveDataSource';
import 'weave.utils.HierarchyUtils';
import 'weave.compiler.Compiler';
var listTables = function(){
var ready = true;
var list = WeaveAPI.SessionManager.getLinkableDescendants(WeaveAPI.globalHashMap, ReferencedColumn).map(function(refcol){
return Object(
@adufilie
adufilie / memoize.ts
Last active January 9, 2018 06:35
Decorator for creating memoized versions of functions in TypeScript
/**
* @author adufilie http://github.com/adufilie
*/
let UNDEFINED = {} as any;
type AnyFunction = (...args:any[])=>any;
function isPrimitive(value:any):boolean
{
@adufilie
adufilie / GenerateEqualityTests.js
Last active January 11, 2017 18:30
Generate double-equality versus triple-equality test code for TypeScript
// run this code in your browser console to generate TypeScript test code
function generateEqualityTests()
{
function stringify(value)
{
if (Object.is(value, undefined) || Object.is(value, NaN))
return '' + value;
return JSON.stringify(value);
}
// test cases from http://dorey.github.io/JavaScript-Equality-Table/