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
m = function() { | |
var getWeek = function(d) { | |
/*getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */ | |
dowOffset = 1; | |
var newYear = new Date(d.getFullYear(),0,1); | |
var day = newYear.getDay() - dowOffset; | |
day = (day >= 0 ? day : day + 7); | |
var daynum = Math.floor((d.getTime() - newYear.getTime() - (d.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1; | |
var weeknum; | |
if (day < 4) { |
if (req.method === 'OPTIONS') { | |
console.log('!OPTIONS'); | |
var headers = {}; | |
// IE8 does not allow domains to be specified, just the * | |
// headers["Access-Control-Allow-Origin"] = req.headers.origin; | |
headers["Access-Control-Allow-Origin"] = "*"; | |
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS"; | |
headers["Access-Control-Allow-Credentials"] = false; | |
headers["Access-Control-Max-Age"] = '86400'; // 24 hours | |
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept"; |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
The Liang-Barsky algorithm is a cheap way to find the intersection points between a line segment and an axis-aligned rectangle. It's a simple algorithm, but the resources I was pointed to didn't have particularly good explanations, so I tried to write a better one.
Consider a rectangle defined by x_min ≤ x ≤ x_max and y_min ≤ y ≤ y_max, and a line segment from (x_0, y_0) to (x_0 + Δ_x, y_0 + Δ_y). We'll be assuming at least one of Δ_x and Δ_y is nonzero.
(I'm working with Flash, so I'll be using the convention that y increases as you go down.)
We want to distinguish between the following cases:
Install Package Control for easy package management.
Ctrl+`
A list of Sketch plugins hosted at GitHub, in no particular order.
/** | |
* Light layer on top of a canvas element to represent an image displayed | |
* within. Pass in a canvas element and an Image object and you'll see the | |
* image within the canvas element. Use the provided methods (e.g. blur) to | |
* manipulate it. | |
* | |
* @constructor | |
* @param {HTMLElement} element HTML canvas element. | |
* @param {Image} image Image object. | |
*/ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.