Skip to content

Instantly share code, notes, and snippets.

View RainerBlessing's full-sized avatar

Rainer Blessing RainerBlessing

  • Stuttgart, Germany
View GitHub Profile
@RainerBlessing
RainerBlessing / https_stub.js
Created September 2, 2012 19:51
A stub for https.get (node.js).
var url = require('url');
var fs = require('fs');
var HTTPSStub = function(){
var handlers={};
var get = function(optionsget, callback){
var p = url.parse(optionsget.path,true);
console.log(p.pathname);
console.log(p.query);
var res = {
@RainerBlessing
RainerBlessing / deploy.rb
Created February 25, 2012 20:10
Capistrano deploy file for git, nginx, thin and sqlite
require 'bundler/capistrano'
set :application, "videonight"
set :repository, "git://github.com/RainerBlessing/Videonight.git"
set :scm, :git
# Prevents error if not parameter passed, assumes that default 'cap deploy' command
# and should deploy the master branch to the production server
set(:env, 'production') unless exists?(:env)
@RainerBlessing
RainerBlessing / gist:1362012
Created November 13, 2011 11:37
Sproutcore 2.0 and Tables
# HTML
<script type="text/html">
<table>
<tr><th>Column One</th><th>Column Two</th></tr>
{{#collection App.CollectionView tagName="tbody"}}
<td>{{content.column_one}}</td><td>{{content.column_two}}</td>
{{/collection}}
</table>
</script>
@RainerBlessing
RainerBlessing / sinatra_bundler.rb
Created June 17, 2011 19:57
Sinatra Application Template
#Gemfile
gem 'sinatra'
#config.ru
require 'rubygems'
require 'bundler'
Bundler.require
require './my_sinatra_app'
diff --git a/lib/foreigner.rb b/lib/foreigner.rb
index 540657a..2eb55aa 100644
--- a/lib/foreigner.rb
+++ b/lib/foreigner.rb
@@ -19,6 +19,14 @@ module Foreigner
end
def configured_adapter
+ if !ActiveRecord::Base.connected?
+ if Rails.application
/*
* jquery dialog - display the "OK" button in a disabled state
* removes the function from the button and adds the class "ui-state-disabled"
*/
if(data.length>0){
options="";
$.each(data, function(i, product){
if(product.product.id!=product_id){
options+= '<option value="'+product.product.id+'">'+product.product.name+'</option>';
}else{
$.ajax({
url: '/categories.json',
type: 'get',
contentType: 'application/json;',
success: function(msg,a) {
$('#product_category_id').empty();
options="";
$.each(msg, function(){
options+= '<option value="'+this.category.id+'">'+this.category.name+'</option>';
});