Skip to content

Instantly share code, notes, and snippets.

View Maciek416's full-sized avatar

Maciej Adwent Maciek416

View GitHub Profile
@prologic
prologic / LearnGoIn5mins.md
Last active July 3, 2024 04:05
Learn Go in ~5mins
@IanColdwater
IanColdwater / twittermute.txt
Last active July 2, 2024 02:25
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@johnhw
johnhw / umap_sparse.py
Last active January 6, 2024 16:09
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var styl = require('gulp-styl');
var refresh = require('gulp-livereload');
var lr = require('tiny-lr');
var server = lr();
var paths = {
js: 'src/**/*.js',
base_events = ['click', 'dblclick', 'mousedown', 'mouseup',
'mouseover', 'mousemove', 'mouseout', 'dragstart', 'drag',
'dragenter', 'dragleave', 'dragover', 'drop', 'dragend', 'keydown',
'keypress', 'keyup', 'load', 'unload', 'abort', 'error', 'resize',
'scroll', 'select', 'change', 'submit', 'reset', 'focus', 'blur',
'focusin', 'focusout', 'DOMActivate', 'DOMSubtreeModified',
'DOMNodeInserted', 'DOMNodeRemoved', 'DOMNodeRemovedFromDocument',
'DOMNodeInsertedIntoDocument', 'DOMAttrModified',
'DOMCharacterDataModified', 'mousewheel', 'wheel']
@willurd
willurd / Getting started with requirejs.md
Last active December 14, 2022 08:15
A short introduction to require.js

This is a small collection of scripts showing how to use require.js. It's only one of several ways of setting up a require.js project, but it's enough to get started.

At its core, require.js is about three things:

  1. Dependency management
  2. Modularity
  3. Dynamic script loading

The following files show how these are achieved.

@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@paulirish
paulirish / rAF.js
Last active July 19, 2024 19:50
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@kieran
kieran / better.greedy.droppables.js
Created April 14, 2011 16:33
still brittle since it depends on active & hover classes, but removing those dependencies should be trivial
$("#element").droppable({
tolerance: 'pointer',
activeClass: 'ui-state-active',
hoverClass: 'ui-state-hover',
drop: function(evt, ui) {
console.log('dropped',evt,ui)
}
});
$('.ui-droppable').live('dropover dropout',function(evt,ui){