Skip to content

Instantly share code, notes, and snippets.

View RainerBlessing's full-sized avatar

Rainer Blessing RainerBlessing

  • Stuttgart, Germany
View GitHub Profile
$.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>';
});
/*
* 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{
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
@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'
@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 / 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 / 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 / README
Last active December 16, 2015 11:49 — forked from rwest/README
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@RainerBlessing
RainerBlessing / gist:5496362
Last active December 16, 2015 20:59
These are instructions to install Intershop 7 in Ubuntu. They are currently incomplete.
# UNFINISHED!
#
#Install Oracle XE: http://meandmyubuntulinux.blogspot.ca/2012/05/installing-oracle-11g-r2-express.html
# + http://meandmyubuntulinux.blogspot.de/2012/06/trouble-shooting-oracle-11g.html
#mkdir /var/lock/subsys
#/etc/init.d/oracle-xe start
#create Intershop user:
#sqlplus sys as sysdba
#create user intershop identified by <password>;
#grant all privileges to intershop;
gem install sinatra
gem install dalli
gem install redis
gem install aboutyou-sdk