This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'deltacloud/base_driver' | |
require 'spherical' | |
module Deltacloud::Drivers::VMware | |
class VMwareDriver < Deltacloud::BaseDriver | |
# Configure hardware profile options | |
define_hardware_profile 'default' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>HTML5 boilerplate—all you really need…</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript" charset="utf-8"></script> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<script type="text/javascript" charset="utf-8"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($){ | |
$.fn.textExtents = function(options){ | |
var spans = $('span:visible', this); | |
var heightMax = parseInt($(this).css('max-height')); | |
var widthMax = parseInt($(this).css('max-width')); | |
var fontSize = options.maxFontSizePx; | |
do{ | |
var textHeight = 0; | |
var textWidth = 0; | |
$(spans).each(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function($){ | |
$.fn.textExtents = function(options){ | |
var spans = $('span:visible', this); | |
var heightMax = parseInt($(this).css('max-height')); | |
var widthMax = parseInt($(this).css('max-width')); | |
var fontSize = parseInt($(this).css('font-size')); /* max font size */ | |
do{ | |
var textHeight = 0; | |
var textWidth = 0; | |
$(spans).each(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Proc | |
def call_with_vars(vars, *args) | |
Struct.new(*vars.keys).new(*vars.values).instance_exec(*args, &self) | |
end | |
end | |
module Touchy | |
class GuardError < Exception; end | |
class GuardSignatureError < GuardError; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'sinatra/namespace' | |
# You may need multi_json | |
class API < Sinatra::Base | |
# Respond to all errors with JSON | |
error do | |
content_type :json | |
e = env['sinatra.error'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User extends Spine.Model | |
url: -> | |
'/' + @username | |
collections: -> | |
unless @collection_klass? | |
@collection_klass = _.clone(Collection) | |
@collection_klass.parent = this | |
@collection_klass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You'll need to add 'rack-rewrite' to your Gemfile. | |
require 'rack/rewrite' | |
require File.expand_path("../config/boot.rb", __FILE__) | |
# lazy load the application, instantiating routes. | |
application = Padrino.application | |
# Determine which routes NOT to redirect to your root resource. | |
reserved_routes = YourProject::App.routes.map{|r| | |
r.path_for_generation.scan /[a-zA-Z0-9]+/i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
class VirtualEnvError < Exception; end | |
class PythonVirtualEnv | |
def self.exists?(path) | |
File.directory?(path) and File.exists?(File.join(path, 'bin/activate')) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rabl | |
class Engine | |
def collection(data, options={}) | |
self.object(data_object(data)) | |
end | |
end | |
module Helpers | |
def data_name(data_token) |
OlderNewer