Skip to content

Instantly share code, notes, and snippets.

View moul's full-sized avatar
🌸
Creating languages for coordinated impact.

Manfred Touron moul

🌸
Creating languages for coordinated impact.
View GitHub Profile
@henrik
henrik / examples.coffee
Created February 12, 2012 21:46
Animate number changes step by step (e.g. "1.1" -> "1.2" -> "1.3") with CoffeeScript and jQuery. And some other methods around number formatting.
# Examples
console.log NumberWrangler.format(123456.78)
console.log NumberWrangler.format("1234")
console.log NumberWrangler.formatDecimalComma("123456.78")
console.log NumberWrangler.parse("123,4 56.78")
console.log NumberWrangler.parseDecimalComma("123.4 56,78")
console.log NumberWrangler.countDecimals(1.2345)
# Requires jQuery:
@moul
moul / cdiscount.com
Created March 27, 2012 14:59
Personalized Web Options
[{"name":"Standard AdBlocker","urlRegex":"^http://","urlExcludeRegex":"","enabled":false,"preserveDocWrite":false,"css":"","html":"","js":"","filters":[{"tags":"div,table","attribute":"id,class","value":"","valueRegex":"([-_]|\\b)(MarketGid(Composite)?\\d+|(adv?|ban(ner)?)\\d+x\\d+|y\\d+_direct\\d+)([-_]|\\b)"},{"tags":"div,table","attribute":"id,class","value":"","valueRegex":"^(top|left|right|bottom)[-_]?(ad|ban(n?er)?)s?\\d*(x\\d+)?$"},{"tags":"div,table","attribute":"id,class","value":"","valueRegex":"([-_]|\\b)(adv?|ban(n?er)?)[-_]?\\d+x\\d+[-_]?[a-z]*([-_]|\\b)"},{"tags":"div,table","attribute":"id,class","value":"","valueRegex":"([-_]|\\b)(bann?er|reklama|advertisement)s?[-_]?\\d*(x\\d+)?([-_]|\\b)"},{"tags":"div,table","attribute":"id,class","value":"","valueRegex":"([-_]|\\b)sidebar[-_]?ads?([-_]|\\b)"},{"tags":"","attribute":"id,class","value":"begun_table,baner,banner,ad,adv,reklama,google_companion_ad_div,google_ads_site,Advertisement,adBar,adBox","valueRegex":""},{"tags":"div","attribute":"id","v
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@andrewdeandrade
andrewdeandrade / app.js
Created June 29, 2012 18:19
Node.js ('child_process').spawn bug with SSH
var spawn = require('child_process').spawn
var instance = {
ipAddress: "0.0.0.0"
};
var awsPreSharedKeyPath = '~/.ssh/aws-preshared-key.pem'; // make sure key has permissions 600 with chmod
var spawnArgs = [ '-tt', // force teletype since ssh uses a psuedo-terminal
@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:

@jedy
jedy / go_scp.go
Last active May 31, 2022 07:20
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@mathieue
mathieue / udp-multi-socat.sh
Created August 28, 2012 23:57
udp multiplexer with socat
socat - udp4-listen:8125,fork | tee >(socat - udp-sendto:127.0.0.1:8135) >(socat - udp-sendto:127.0.0.1:8140)
@pathikrit
pathikrit / sudoku-1.coffee
Created October 10, 2012 07:04
1-liner CoffeeScript Sudoku Solver
solve = (s, c = 0) -> if c is 81 then s else if s[x = c/9|0][y = c%9] isnt 0 then solve s, c+1 else (([1..9].filter (g) -> ![0...9].some (i) -> g in [s[x][i], s[i][y], s[3*(x/3|0) + i/3|0][3*(y/3|0) + i%3]]).some (g) -> s[x][y] = g; solve s, c+1) or s[x][y] = 0
@guiambros
guiambros / cloud-init.sh
Created October 22, 2012 01:29
Cloud-Init.sh - Amazon EC2 initial instance setup script (tested with Ubuntu 12.04 LTS)
#!/bin/bash
function getpublickey()
{
x=$(curl -fs http://169.254.169.254/latest/meta-data/public-keys/)
if [ $? -eq 0 ]; then
for i in $x; do
index=$(echo $i|cut -d = -f 1)
format=$(curl -s http://169.254.169.254/latest/meta-data/public-keys/$index/)
echo $(curl -s http://169.254.169.254/latest/meta-data/public-keys/$index/$format)
@minitech
minitech / web-checklist.md
Last active January 4, 2020 11:59
minitech’s Web Checklist

minitech’s Web Checklist

Here are some guidelines that will make me actually like your amazing new web application!

  1. Make sure encoding is handled properly every step of the way. If comes out as ’, you’ve got a problem on your hands. 😊

  2. Make it accessible. Turn off images, JavaScript, and CSS. If your website is still legible and usable (it’s okay if it’s just barely usable, or not particularly interactive) then you are already in the top 0.01%.

  3. Check your grammar. One of the fastest ways to lose respect in a blog post (or worse — in body copy) is to make basic orthographical or grammatical mistakes. These include, but are not limited to:

  • Missing apostrophes — [Bitbucket even did that][bitbucket-apostrophe-catastrophe].