This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Export Root Bodies and Objects Inside Root Groups to STL | |
# | |
# This is a FreeCAD script to export all visible root bodies and objects inside root groups in STL mesh format. | |
# Files will be stored inside an "exported_YYYY-MM-DD_HH-mm-ss" subfolder and named as "documentname_groupname_bodylabel.stl" or "documentname_bodylabel.stl". | |
# | |
import FreeCAD | |
import os.path | |
import datetime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Game of Life, also known simply as Life, is a | |
// cellular automaton devised by the British | |
// mathematician John Horton Conway in 1970. | |
// | |
// https://en.wikipedia.org/wiki/Conway's_Game_of_Life | |
let width: i32; | |
let height: i32; | |
let size: i32; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gulp = require('gulp'); | |
gulp.task('build', callback => { | |
const asc = require('assemblyscript/bin/asc'); | |
asc.main( | |
[ | |
'main.ts', | |
'--baseDir', | |
'assembly', | |
'--binaryFile', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set up the canvas with a 2D rendering context | |
const canvas = document.getElementById('canvas'); | |
const context = canvas.getContext('2d'); | |
const boundingClientRect = canvas.getBoundingClientRect(); | |
canvas.width = boundingClientRect.width | 0; | |
canvas.height = boundingClientRect.height | 0; | |
// Compute the size of the universe (here: 2px per cell) | |
const width = boundingClientRect.width >>> 1; | |
const height = boundingClientRect.height >>> 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<style> | |
html, | |
body { | |
height: 100%; | |
margin: 0; | |
overflow: hidden; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deep_symbolize_keys = lambda do |hash| | |
return hash unless hash.is_a?(Hash) | |
Hash[ hash.map do |key, value| | |
# if value is array, loop each element and recursively symbolize keys | |
if value.is_a? Array | |
value = value.map { |element| symbolize_keys.call(element) } | |
# if value is hash, recursively symbolize keys | |
elsif value.is_a? Hash | |
value = symbolize_keys.call(value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
status = 'reopened' | |
status = 'closed' if status =~ /(opened|reopened)/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_method(a, b, c=15, d=35, *p, e) | |
puts ["a: #{a}", | |
"b: #{b}", | |
"c: #{c}", | |
"d: #{d}", | |
"p: #{p.inspect}", | |
"e: #{e}"].join(', ') | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts 'Hello, world!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "net/http" | |
def start_server | |
# Remove the X to enable the parameters for tuning. | |
# These are the default values as of Ruby 2.2.0. | |
@child = spawn(<<-EOC.split.join(" ")) | |
XRUBY_GC_HEAP_FREE_SLOTS=4096 | |
XRUBY_GC_HEAP_INIT_SLOTS=10000 | |
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8 | |
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0 |
NewerOlder