Skip to content

Instantly share code, notes, and snippets.

G21 ; Set metric values
G90 ; Set absolute positioning
M82 ; Set extruder to absolute mode
G28 X0 Y0 ; Move X/Y to min endstops
G28 Z0 ; Move Z to min endstops
G1 Z20 ; Raise Z to 20mm
M190 S{material_bed_temperature_layer_0} ; Wait for bed temperature to reach target
M109 S{material_print_temperature_layer_0} T0 ; Set extruder temperature and wait
G29 ; Auto-leveling
G1 X0 Y0 F3000 ; Go to home (without homing: it would disable compensation)
<style>
div#hello-jz > h3 {
border: 5px solid red;
}
</style>
<div id="hello-jz">
<h3>Hello, JZ</h3>
<div>
@jonaphin
jonaphin / ieuploadfix.js
Last active December 27, 2015 05:19
IE 10 - Fix Double-Click Issue on File Upload Buttons
$(document).ready(function(){
if ($.browser.msie && parseInt($.browser.version) >= 10) {
$("body").on("mousedown", ".photo_uploader input[type='file']", function(){
$(this).click();
});
}
});
@jonaphin
jonaphin / gist:6107815
Created July 29, 2013 21:04
id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCiP5RhaE57ph0HGzakk5bqpZ2T/KORQZmm8VsZC+117iEL4yzmUmG1QWDoZ/fgBI7Fq0N9B9OjVoC1IOEzTRBZspeFOYIRQa3FhbvVTHsgNALp+ES3Sw4JOuWJljB88RhHCpCdFAII7dM8nQLyTYceLsMfHu6lmym2G+2DMeh3WL76kPcZuZDz2MS9PCNgyRGr4eER7m4H8tjCnI9tVrvKPpaqNHTH4eRLHYY6DO8QOsOrPcfeuGVCQW5xI8xIZzPqc/KxlXcRwg0qqO/o80nNPa8aygw0vrucLMOi3IRTqV8pwrkh+HyNDkijLknPnhOvNNr+GoVtjgYvzqwJ87qL [email protected]
@jonaphin
jonaphin / review.rb
Last active December 16, 2015 08:49
code review
if(@app.is_site_cat_enabled?)
raw %Q{
CO.Events.trigger('navigate_screen', $.extend(#{opts}, {
screen_permanent_id: '#{navigation_target.permanent_id}',
source_component_id: '#{source_component.id}'
}));
} + sc_trigger
else
raw %Q{
CO.Events.trigger('navigate_screen', $.extend(#{opts}, {
@jonaphin
jonaphin / binary_search_tree.rb
Created May 9, 2012 15:29
Binary Search Tree in Ruby
#
# Copyright (c) 2012 Jonathan Lancar
# Licensed under the MIT license.
#
module JLancar
BSTNode = Struct.new(:value, :left_node, :right_node)
class BinaryTree
attr_accessor :root_node
@jonaphin
jonaphin / class_to_proc.rb
Created June 30, 2011 00:12
Class#to_proc Implementation
### Jonathan Lancar - https://github.com/jonaphin ###
#########################
#### Class#to_proc ####
#########################
class Class
# Initialize multiple objects at once
def to_proc
proc{ |*args| self.new *args }
end
@jonaphin
jonaphin / string_to_proc.rb
Created June 29, 2011 01:59
String#to_proc
### Jonathan Lancar - https://github.com/jonaphin ###
###################################
## String#to_proc Implementation ##
###################################
class String
# Evaluates a string as ruby code
def to_proc
proc { |arg| eval "#{arg}#{self}" }
end
@jonaphin
jonaphin / regex_to_proc.rb
Created June 29, 2011 01:57
Regexp#to_proc
### Jonathan Lancar - https://github.com/jonaphin ###
## Match Regular Expression to one or multiple strings
class Regexp
def to_proc
proc { |arg| arg.to_s[self] }
end
end
## USE CASE ##
@jonaphin
jonaphin / Hash_to_proc.rb
Created June 28, 2011 03:53
Fun with Hashes and to_proc implementation
### Jonathan Lancar - https://github.com/jonaphin ###
#########################
## Simple Hash Example ##
#########################
class Hash
# if argument passed to the hash is a key of it,
# call the hash's value (at key) as a method that acts on said key
def to_proc
proc { |arg| self.has_key?(arg) ? self[arg].to_proc.call(arg) : arg }