Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Hello World

Blaine Schanfeldt blaines

:shipit:
Hello World
View GitHub Profile
View gist:1daf6cd0b5756e9bc718
> Pathname.new 'uri:classloader:/Users/bschanfeldt/Repos/Github/jruby/jruby/README.md'
=> <Pathname:uri:classloader:/Users/bschanfeldt/Repos/Github/jruby/jruby/README.md>
> p = _
=> <Pathname:uri:classloader:/Users/bschanfeldt/Repos/Github/jruby/jruby/README.md>
> p.absolute?
=> false
View gist:898d49c6853209084551
> RUBY_VERSION
=> "1.9.3"
> RUBY_PLATFORM
=> "java"
> JR
JRUBY_REVISION JRUBY_VERSION JRuby
> JR
JRUBY_REVISION JRUBY_VERSION JRuby
> JRUBY_
JRUBY_REVISION JRUBY_VERSION
@blaines
blaines / gist:181566
Created Sep 5, 2009
Creates an encrypted, base64 encoded url containing signup form parameters. Used for database-less email verification.
View gist:181566
class UsersController < ApplicationController
# Creates an encrypted, base64 encoded url. http://localhost/confirm?_=hBRCGVqie5PetQhjiagq9F6kmi7luVxpcpEYMWaxrtSHIPA3rF0Hufy6EgiH%0A%2BL3t9dcgV9es9Zywkl4F1lcMyA%3D%3D%0A
@to_encrypt = save_space(params[:user], {:firstname => :fn,:lastname => :ln,:email => :el,:username => :un,:password => :pd})
encrypted_params = CGI::escape(Base64.encode64(encrypt(Marshal.dump(@to_encrypt), "secret")))
render :text => "#{encrypted_params}"
def confirm
@decrypted = Marshal.load(decrypt(Base64.decode64(params[:_]), "secret"))
View gist:181679
module Prawn
class Document
#module CropMarks
def draw_crop_marks(spacing, margin, lineweight)
#crop mark line thickness
line_width(lineweight)
#spacing = 2.125
#margin = 9
@blaines
blaines / gist:203968
Created Oct 7, 2009
A recursive from_xml
View gist:203968
def import
xml = open(params[:_]).read # Param for opening an XML file ( http://localhost/import?_=http://localhost/companies.xml )
doc = REXML::Document.new(xml)
@import = initialize_import(doc)
respond_to do |format|
format.html
end
end
# Process parent XML elements
View gist:446275
template =
{
form:{
method:"post","class":["new","blogpost"],fields:[
{name:"title",type:"text","class":"title"},
{name:"body",type:"textarea","class":"body"}
]
}
};
// now try
@blaines
blaines / Assembla Userstyle
Created Feb 8, 2011
Using gist because it delivers https!
View Assembla Userstyle
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("assembla.com") {
#header-w, #main-menu-w, .menu-wrapper {
background-color: #222 !important
}
ul#main-menu li, .more_tabs_menu_item {
background-color: #900 !important
View gist:3136928
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman">Hello world</Say>
<Play>http://www.radiolovers.com/shows/J/Journeytothecenteroftheearth/Lost.mp3</Play>
</Response>
View gist:2433c3cfc22e1290609f7847e8c5cf00
diff --git a/private/protocol/restxml/restxml.go b/private/protocol/restxml/restxml.go
index 65faeae..27e0e86 100644
--- a/private/protocol/restxml/restxml.go
+++ b/private/protocol/restxml/restxml.go
@@ -8,7 +8,10 @@ package restxml
import (
"bytes"
"encoding/xml"
+ "fmt"
"io"
@blaines
blaines / Dockerfile
Created Jan 11, 2019
Dockerfile to echo Docker events to STDOUT (So they are captured by logs)
View Dockerfile
FROM alpine
RUN apk add --no-cache curl
ENTRYPOINT curl -sf --unix-socket /var/run/docker.sock -H "Content-Type: application/json" -X GET http:/v1.39/events