Skip to content

Instantly share code, notes, and snippets.

View girasquid's full-sized avatar
🦐

Luke Hutscal girasquid

🦐
View GitHub Profile
@dominicfreeston
dominicfreeston / nine_slice.rb
Created March 16, 2023 22:02
nine-slice (stretching) for dragonruby
def nine_slice sprite
x = sprite.x
y = sprite.y
w = sprite.w
h = sprite.h
path = sprite.path
t_x = sprite.tile_x
t_y = sprite.tile_y
o_w = sprite.tile_w
o_h = sprite.tile_h
@xenobrain
xenobrain / circles.rb
Last active October 12, 2023 14:42
circles for dragonruby
module GTK
class Runtime
def draw_circle c
radius = c.radius.to_i || 0
xc = c.x.to_i + radius
yc = c.y.to_i + radius
t = c.thickness || 1
r = c.r || 0
g = c.g || 0
b = c.b || 0
@qrush
qrush / application_job.rb
Last active March 31, 2020 01:38
Use Honeycomb to trace ActiveRecord calls inside of ActiveJob
class ApplicationJob < ActiveJob::Base
around_perform do |job, block|
Honeycomb.start_span(name: job.class.name) do |span|
span.add_field 'type', 'worker'
span.add_field 'queue.name', job.queue_name
block.call
end
end
end
@mholt
mholt / macapp.go
Last active July 21, 2024 09:43
Distribute your Go program (or any single binary) as a native macOS application
// Package main is a sample macOS-app-bundling program to demonstrate how to
// automate the process described in this tutorial:
//
// https://medium.com/@mattholt/packaging-a-go-application-for-macos-f7084b00f6b5
//
// Bundling the .app is the first thing it does, and creating the DMG is the
// second. Making the DMG is optional, and is only done if you provide
// the template DMG file, which you have to create beforehand.
//
// Example use:
@sathiyaseelan
sathiyaseelan / golang_setup.md
Last active April 1, 2024 18:51
Basics to setup a golang project repo in your local

Simple Guide to setup Golang in your Mac and clone a repo.

Setup Go and workspace

Type go in terminal, to verify the installation.

  • Create a Go workspace and set GO PATH
@stevedev
stevedev / fish
Created August 28, 2017 20:06
Fish tank generator for slack. Because.
#!/usr/bin/ruby
# some fish!
fish = %w{ fish fish2 fish3 fish4 fish5 fish6 fish7 }
# At least 3 lines
lines = rand(4) + 3
output = ""

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

package {
import starling.core.Starling;
import starling.animation.Transitions;
import starling.animation.Tween;
public class Utils {
// This function accepts an originalX and originalY so that you can shake things that
// are on screen but not necessarily originally located at 0, 0 (compared to the original
// implementation which only ever moved things back to 0, 0)
public static function screenShake(drawable:Shakeable, shakeDuration:Number, intensity:Number, originalX:Number, originalY:Number):void {
@fw42
fw42 / gist:93727d046b827fab4751
Last active August 29, 2015 14:08
Module#prepend with C extensions
#!/usr/bin/env ruby
require 'socket'
require 'openssl'
module Foo
end
OpenSSL::SSL::SSLSocket.prepend(Foo)
# This line crashes with the prepend() but works without it

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am