Skip to content

Instantly share code, notes, and snippets.

View Maciek416's full-sized avatar

Maciej Adwent Maciek416

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {
@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){
@paulirish
paulirish / rAF.js
Last active April 17, 2025 15:06
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'];
@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 = [email protected]: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:

@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.


@willurd
willurd / Getting started with requirejs.md
Last active August 7, 2024 06:24
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.

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']
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',
@johnhw
johnhw / umap_sparse.py
Last active February 26, 2025 10:50
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
@IanColdwater
IanColdwater / twittermute.txt
Last active April 14, 2025 16:31
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