Skip to content

Instantly share code, notes, and snippets.

@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@paulirish
paulirish / rAF.js
Last active July 2, 2024 11:59
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'];
@tcabrol
tcabrol / movie_recommender.py
Created April 8, 2012 00:15
Movie Recommender :: Python
#!/usr/bin/env python
# encoding: utf-8
"""
movie_recommender.py
Created by Thomas Cabrol on 2012-04-06.
Copyright (c) 2012 __MyCompanyName__. All rights reserved.
"""
import csv
@Nurdok
Nurdok / python_conversion.md
Last active December 16, 2022 03:45
Python Conversion

Python Number Conversion Chart

From To Expression
@willurd
willurd / web-servers.md
Last active July 6, 2024 23:56
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rossant
rossant / raytracing.py
Last active June 25, 2024 20:58
Very simple ray tracing engine in (almost) pure Python. Depends on NumPy and Matplotlib. Diffuse and specular lighting, simple shadows, reflections, no refraction. Purely sequential algorithm, slow execution.
"""
MIT License
Copyright (c) 2017 Cyrille Rossant
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active October 24, 2022 19:20
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@kohyama
kohyama / README.md
Last active February 6, 2021 12:41
A minimum setting to use browser REPL of ClojureScript

A minimum setting to use browser REPL of ClojureScript

Assumed that you have set leiningen up and can use it.

1. Prepare files

Copy project.clj, repl-test.cljs and brepl-test.html from this gist or git clone this gist and move or copy repl-test.cljs under src directory.

$ git clone https://gist.github.com/6183122.git
$ cd 6183122/
@ChillyBwoy
ChillyBwoy / core.cljs
Created May 22, 2014 23:54
Simple particles in ClojureScript
(ns particles.core)
(def display (.getElementById js/document "display"))
(def context (.getContext display "2d"))
(def damping 0.999)
(def max-particles 250)
(def line-width 2)
(def app-state (atom {:width (.-innerWidth js/window)
:height (.-innerHeight js/window)}))
@lh3
lh3 / eigen.c
Created November 8, 2014 04:53
Eigenvalues/vectors for symmetric and asymmetric matrices
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define RADIX 2.0
/*************************
* balance a real matrix *
*************************/