Skip to content

Instantly share code, notes, and snippets.

function update () {
// Draw!
renderer.render(scene, camera);
sphere.rotation.y += 0.01
sphere.rotation.z += 0.01
// Schedule the next frame.
requestAnimationFrame(update);
}
// create the sphere's material
const sphereMaterial =
new THREE.MeshLambertMaterial(
{
color: 0xCC0000,
wireframe: true
});
// Set up the sphere vars
const RADIUS = 50;
// create a point light
const pointLight = new THREE.PointLight(0xFFFFFF);
// set its position
pointLight.position.x = 10;
pointLight.position.y = 50;
pointLight.position.z = 130;
// add to the scene
scene.add(pointLight);
// Get the DOM element to attach to
const container = document.querySelector('#container');
// Attach the renderer-supplied
// DOM element.
container.appendChild(renderer.domElement);
// Set the scene size.
const WIDTH = window.innerWidth;
const HEIGHT = window.innerHeight;
// Set some camera attributes.
const VIEW_ANGLE = 45;
const ASPECT = WIDTH / HEIGHT;
const NEAR = 0.1;
const FAR = 10000;
// Set the scene size.
const WIDTH = window.innerWidth;
const HEIGHT = window.innerHeight;
// Set some camera attributes.
const VIEW_ANGLE = 45;
const ASPECT = WIDTH / HEIGHT;
const NEAR = 0.1;
const FAR = 10000;
@peyloride
peyloride / numpy.py
Last active January 2, 2019 19:04
Numpy scale and rotate stl file
my_mesh = mesh.Mesh.from_file('wheel.stl')
my_mesh.vectors *= 5 # Scale mesh to 5 times bigger
my_mesh.rotate([0.5, 0.0, 0.0], math.radians(90)) # Rotate mesh 90° on x axis
my_mesh.save('scaled_wheel.stl')
@peyloride
peyloride / gist:ac4f5d5fcae78d04894a0d66a16500d7
Created October 30, 2018 17:31
LinuxBrew Error on Solus
HOMEBREW_VERSION: 1.8.0
ORIGIN: https://github.com/Linuxbrew/brew
HEAD: 8f5de98bcc40afe402969dff6794739979b00a09
Last commit: 7 days ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: e2cc895aaeab39c9d77dbfdcd00eb9771c9e137b
Core tap last commit: 20 hours ago
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CACHE: /home/peyloride/.cache/Homebrew
CPU: octa-core 64-bit haswell
@peyloride
peyloride / OpenSSL fix.md
Created February 10, 2018 08:12 — forked from mislav/OpenSSL fix.md
Fix OpenSSL certificate errors on Ruby 2.0

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

@peyloride
peyloride / assets.rake
Created January 29, 2018 07:53
Rails detect failed .css or .scss file
#Source: https://stackoverflow.com/questions/41649496/error-precompiling-assets-when-moving-to-production/41650364#41650364
namespace :assets do
desc "Find Sass::SyntaxError files..."
task find_scss_with_error: :environment do
files = Dir.glob( Rails.root.join("app", "assets", "stylesheets", "**/*")).grep(/.*\.[css|scss]/)
files.each do |file|
print "Trying to compile #{file}..."
template = File.read(file)
sass_engine = Sass::Engine.new(template)