Skip to content

Instantly share code, notes, and snippets.

@thedod
thedod / README.md
Last active April 17, 2022 22:30
White House petition sigs by state
@jspacker
jspacker / gist:5287444
Last active September 15, 2021 21:32
pagerank blogpost super-rough draft

What's Important In My Data? Measuring Influence Using PageRank And Mortar

Networks are everywhere in a data-driven world: social networks, product purchasing networks, supply chain networks, or even biological networks. If your company sells anything to anyone, you will have data that can be modelled as a network, the mathematical term for which is a "graph". Analyzing these graphs can explain how fundamental social, commercial, and physical systems behave, and consequently, how to make money from them (Google revenue in 2012: $50 billion).

The problem is, there is often so much data that it can be hard to tell what one should even try to analyze. One of the first questions to ask then is "which parts of my graph dataset are the most important?"--for example, before one can investigate how Twitter users become influential, one has to find who the most influential Twitter users are in the first place.

A well-known algorithm for finding the most important nodes in a graph is called [Pagerank](http://en.wi

@gnarf
gnarf / ..git-pr.md
Last active January 27, 2025 01:56
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active March 21, 2025 15:01
Backend Architectures Keywords and References
cellvibr.io
pelobact.er
shewane.la
myxococc.us
stigmate.la
cystobact.er
nannocyst.is
vitreosci.la
lysobact.er
simonsie.la
@aheckmann
aheckmann / mongoose-cpu-load-test.js
Created August 28, 2013 03:00
tweak various mongoose settings to observe cpu impact.
/**
* configuration
*/
// connection pool size
var poolSize = 5;
// number of parallel queries
var n = 60;
//find first occurrence of a char in a given word
function first_unique_char(word)
{
letter_obj = new Object();
word_array = word.split('');
//first setup hash to store occurrences of char
for (var letter in word_array){
if (letter_obj[word_array[letter]] === undefined){
letter_obj[word_array[letter]] = 1;}
@Liampronan
Liampronan / create_hash_from_two_arrays.rb
Created October 15, 2013 16:26
warmup 10/15 -beginning ruby - function to take two arrays of equal length and return a hash with array1 values as keys and array2 values as values
# input is two arrays; output is hash with first array values as key and second array values as values; assume same size
def hashable(array1,array2)
combined_hash = {}
array1.each_with_index do |val, index|
combined_hash[val] = array2[index]
end
return combined_hash
@140am
140am / gist:7463028
Last active May 3, 2022 16:12
Exampel of arrow Key Navigation via Statechart events in JavaScript. from http://stativ.us
$(document).bind('keydown', function(evt){
var myStatechart = window.myStatechart, kid,
keyKey = {'38':'Up', '39': 'Right', '40':'Down', '37': 'Left', '13': 'Enter'};
console.log('Which: ', evt.which);
kid = keyKey[evt.which];
if (kid) myStatechart.sendEvent('key'+kid);
});
@sindresorhus
sindresorhus / post-merge
Last active May 17, 2025 14:19
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"