Skip to content

Instantly share code, notes, and snippets.

@sgraber
sgraber / ScalePictures40.vb
Created February 8, 2018 14:30 — forked from kristopherjohnson/ScalePictures40.vb
Microsoft Word macro to resize all pictures in a document to 40% of original size
Sub ScalePictures40()
Dim i As Long
With ActiveDocument
For i = 1 To .InlineShapes.Count
With .InlineShapes(i)
.ScaleHeight = 40
.ScaleWidth = 40
End With
Next i
End With
@sgraber
sgraber / gist:2701d0bdbfb87a8260cb
Last active August 29, 2015 14:04
grbl 0.8c dump for LittleRP for Tilt
$0=200.000 (x, step/mm)
$1=4250.000 (y, step/mm)
$2=200.000 (z, step/mm)
$3=30 (step pulse, usec)
$4=200.000 (default feed, mm/min)
$5=200.000 (default seek, mm/min)
$6=255 (step port invert mask, int:11111111)
$7=200 (step idle delay, msec)
$8=25.000 (acceleration, mm/sec^2)
$9=0.050 (junction deviation, mm)
@sgraber
sgraber / gist:864968
Created March 10, 2011 21:29 — forked from benvinegar/gist:414837
Disqus Comments Reload
<!-- You'll need to call get_disqus_num_replies() every time you alter the content (ex - ajax) -->
<script type="text/javascript">
//<![CDATA[
var get_disqus_num_replies = function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
@sgraber
sgraber / gist:842930
Created February 24, 2011 21:33
Reddit Bookmarklet to Add URLs to Links in Pages Before Printing
// Reddit Bookmarklet to Add URLs to Links in Pages Before Printing
// Add to your bookmark bar and click on it on any Reddit page and hyperlinks will have their
// URLs added right below the link. Nice for printing!
javascript:var x=$(".content").find("div.md a").each(function(){var href= (this).attr("href");$(this).after("<br \/>"+href);});
// ==UserScript==
// @name Plone Show All
// @namespace http://plone.org
// @description Forces folder_contents view to always show all content as opposed to batching.
// @include http://*advancedaquarist.com/*
// @include http://*reefs.org/*
// @include http://*aquaristcourses.org/*
// ==/UserScript==
h = window.location.href;
// On Hover add and Remove a class
$('.onhover').hover(
function(){ $(this).addClass('hover_style_class') },
function(){ $(this).removeClass('hover_style_class') }
)
// max height for columns using jQuery
// Unfortunately css does not support this natively, sometimes when creating column based
// layouts it looks so much better if the columns aligned by height, so here is the easy way
// of doing this.
var max_height = 0;
$("div.col").each(function(){
if ($(this).height() > max_height) { max_height = $(this).height(); }
});
// Value swap (usually for search fields)
// whenever you have a search field and you want it to defaultly display a value “search…”
// and have that value empty out on focus, well this is how to do this with jQuery 1.4.
swap_val = [];
$(".swap").each(function(i){
swap_val[i] = $(this).val();
$(this).focusin(function(){
if ($(this).val() == swap_val[i]) {
$(this).val("");
// quick copy paste jQuery starter embed
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
// jQuery Code Here
});
</script>