Skip to content

Instantly share code, notes, and snippets.

Computer Information:
Manufacturer: ASUSTeK COMPUTER INC.
Model: PRIME Z390-P
Form Factor: Desktop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Brand: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
CPU Family: 0x6
// create a new progress meter
ProgressMeter pm = new ProgressMeter();
// set text for meter
pm.Start("Doing task..");
// set upper limit, what is considered 100% full
pm.SetLimit(Count);
for (int i = 0; i < Count; i++)
@chrisbrasington
chrisbrasington / README.md
Last active July 25, 2016 17:53
Lengthen or Shorten a 3D Line by a length constant

Using current member structure, find deltas.

$$\Delta_x=\frac{x_2-x_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}}$$

$$\Delta_y=\frac{y_2-y_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}}$$

$$\Delta_z=\frac{z_2-z_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}}$$

c = new length constant

@chrisbrasington
chrisbrasington / README.md
Last active August 29, 2015 14:01
last.FM API call building

last.FM API call building with parameters

I wanted a way to call the last.FM API with little hassle. Any function, any callback, and less I had to deal with AJAX syntax the better. I implemented a calling method to build out a request URL from parameters given, and also set the successfull callback to handle the method.

In this example I'm calling user.getRecentTracks.

This type of request building works for all function calls.

Note: that a "Successful" callback will be hit for both receiving the data you desire as well as an invalid response from the API such as "that method did not exist" or "missing parameters". Trickier to handle, means you either need to ensure your parameters/call works, or handle a scenario of always getting an "error" JSON object from last.fm in a successful callback. An AJAX ERROR callback means you got no response from last.FM, it's different.

@chrisbrasington
chrisbrasington / README.md
Last active August 29, 2015 14:01
what is bl.ocks?

bl.ocks, the Gists viewer

Well, it's this thing you're looking at right now. But where does it come from?

Given you have an account to github because you're a cool programmer, you have have available something called Gists. Gists exists to share snippets and blurbs of code with others outside the context of a project or repository.

bl.ocks.org piggy-backs off your Gists post and builds a page for you. So all my posts at https://gist.github.com/chrisbrasington create a page on http://bl.ocks.org/chrisbrasington.

Checkout a cool example from its creator, mbostock.

@chrisbrasington
chrisbrasington / README.md
Last active October 17, 2020 03:21
three.js object loader

#three.js javascript 3D Library - OBJ loader

This object was created in blender and exported as an .OBJ file using the three.js OBJLoader.js

It's important you check that you have your normals correct on your model.

@chrisbrasington
chrisbrasington / README.md
Last active August 29, 2015 14:01
three.js (web.gl) sphere

#three.js javascript 3D Library.

This sphere was created with a pointlight and basic material color. Interestingly, rather than pulsate the light in and out, pulsating the red-black hue had the same effect. Various mouse event handlers were implemented for movement. Camera stays focused looking at origin of sphere/world.

Press D to see DEBUG information.