Skip to content

Instantly share code, notes, and snippets.

View jenrzzz's full-sized avatar

Jenner La Fave jenrzzz

View GitHub Profile
@jenrzzz
jenrzzz / gist:2876718
Created June 5, 2012 18:25
Normalize row height
$(document).ready(function() {
$('.normheight').css({
'height': $('.normheight').height()
});
});
@jenrzzz
jenrzzz / gist:3308273
Created August 9, 2012 21:40
puppet host lookup
require 'resolv'
module Puppet::Parser::Functions
newfunction(:get_ip_addr, :type => :rvalue) do |args|
# Super sexy regex to match valid IPs
ip_addr_re = /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/
hostname = args[0].strip
if hostname =~ ip_addr_re then return hostname end
begin
Resolv::DNS.open { |dns| return dns.getaddress hostname }
@jenrzzz
jenrzzz / client.go
Created April 16, 2013 06:46
199 Go sockets practice
package main
import ("net"; "fmt"; "log")
func main() {
conn, err := net.Dial("tcp", "localhost:9999")
if err != nil {
log.Panic(err)
}
@jenrzzz
jenrzzz / gist:5588205
Created May 15, 2013 23:19
tmux session switcher function
function sesh() {
if [[ $# -gt 0 ]]; then
case "$1" in
new)
tmux new -s "$2"
;;
*)
if tmux list-sessions | grep "attached"; then
tmux switch -t "$1"
else
@jenrzzz
jenrzzz / test.s
Last active December 17, 2015 18:18
.section ".data"
.global fmt
fmt:
.asciz "uninit value: %d\n"
.section ".bss"
.global a
a: .skip 4
.section ".text"
#include <stdio.h>
float float_1( float a, float b ) {
return a + b;
}
float float2( float a, float b ) {
return a + b;
}
.file "test.c"
.section ".text"
.align 4
.global float_1
.type float_1, #function
.proc 06
float_1:
save %sp, -96, %sp
st %i0, [%fp+68]
st %i1, [%fp+72]
sudo rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm
class Like < ActiveRecord::Base
belongs_to :likeable, polymorphic: true
belongs_to :user
end
class Project < ActiveRecord::Base
has_many :likes, as: :likeable
end
class Source < ActiveRecord::Base

Keybase proof

I hereby claim:

  • I am jenrzzz on github.
  • I am jenrzzz (https://keybase.io/jenrzzz) on keybase.
  • I have a public key whose fingerprint is B598 9E66 2182 C4FA 74E6 A5AB F423 CA23 8536 8436

To claim this, I am signing this object: