Skip to content

Instantly share code, notes, and snippets.

@zinkkrysty
zinkkrysty / padded_box_helper.rb
Created December 18, 2012 10:35
Automatic padding of bounding box in Prawn, and allows for filling in the background color. Currently only when specifying height, but I'm open to suggestions.
require 'prawn'
module PaddedBoxHelper
#
# Fills the background of the box you're in
#
def fill_bg_color color
float do
fill_color color
@zinkkrysty
zinkkrysty / resolution_regex.md
Last active September 15, 2020 09:05
Screen resolution regular expression for Google Analytics

/^([0-9].*)x([1-8][0-9][0-9])$/

function countNodes(elem) {
const nodeCount = elem.getElementsByTagName('*').length;
elem.setAttribute('data-nodes', nodeCount);
[].slice.call(elem.children).forEach(countNodes);
}
@zinkkrysty
zinkkrysty / -1520868841710.log
Created March 12, 2018 15:49
Atom Github preview diff pane error
<embedded>:121087 IntersectionObserver.observe(target): target element is not a descendant of root.
TreeView @ <embedded>:121087
<embedded>:25811 Enabled theme 'no-caffeine-syntax' is not installed.
warnForNonExistentThemes @ <embedded>:25811
<embedded>:267185 Uncaught (in promise) Error: RelayModernGraphQLTag: Expected an request, got `{"fragment":{"argumentDefinitions":[{"kind":"LocalArgument","name":"prUrl","type":"URI!","defaultValue":null}],"kind":"Fragment","metadata":null,"name":"PrInfoControllerByUrlQuery","selections":[{"kind":"LinkedField","alias":null,"args":[{"kind":"Variable","name":"url","variableName":"prUrl","type":"URI!"}],"concreteType":null,"name":"resource","plural":false,"selections":[{"kind":"FragmentSpread","name":"PrSelectionByUrlContainer_resource","args":null}],"storageKey":null}],"type":"Query"},"id":null,"kind":"Batch","metadata":{},"name":"PrInfoControllerByUrlQuery","query":{"argumentDefinitions":[{"kind":"LocalArgument","name":"prUrl","type":"URI!","defaultValue":null}],"kind":"
#include "HX711.h"
//HX711 scale(D5, D6, 128);
byte PD_SCK = D5;
byte DOUT = D6;
byte GAIN;
long OFFSET;
float SCALE;
float calibration_factor = 2230; // this calibration factor is adjusted according to my load cell
@zinkkrysty
zinkkrysty / resize_images.sh
Created March 20, 2017 12:49
Resize and optimize images
#!/bin/bash
for image in $( ls *.{jpg,jpeg} ); do
# Get the width and height
height=`sips --getProperty pixelHeight $image | sed -E "s/.*pixelHeight: ([0-9]+)/\1/g" | tail -1`
width=`sips --getProperty pixelWidth $image | sed -E "s/.*pixelWidth: ([0-9]+)/\1/g" | tail -1`
if [[ $height -gt 600 || $width -gt 800 ]]; then
echo "large file ($image) needs reducing"
@zinkkrysty
zinkkrysty / drawing_tool.js
Last active April 19, 2016 15:40
Drawing tool made with Bonsai.js (http://orbit.bonsaijs.org/)
var myStage;
var startDrag;
var myRect;
//
//Shape abstraction
//
//var RectShape = function(x, y, width, height){
// this.bonsaiRect = new Rect(x, y, width, height);
@zinkkrysty
zinkkrysty / _social_icons.css.sass
Created November 27, 2013 13:14
Rounded social icons sass snippet. Twitter, facebook, google+ and flexibility to add more.
// Image: http://f.cl.ly/items/3Q0G130q0g1Z0b3g471v/social_icons_rounded.png
//
// Rounded social icons 34x34
//
=social-icon-rounded($list-index)
background: image-url('social_icons_rounded.png') no-repeat $list-index*(-34px) 0
width: 34px
height: 34px
display: inline-block
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>
@zinkkrysty
zinkkrysty / 0_readme.markdown
Last active December 9, 2015 16:58 — forked from mrdanadams/create_origin.sh
Use Dropbox for a git repository in the cloud. I use it for backup purposes.