Skip to content

Instantly share code, notes, and snippets.

@Juice10
Juice10 / gist:348481f88fb20b393b77
Last active August 29, 2015 14:23
very impressive card game
# 52 cards print them line by line
def setup_players
players = []
playersNumber = (2..10).to_a.sample
playersNumber.times do |player|
players << []
end
players
end
def login_as(user)
request.session[:account_id] = user ? users(user).id : nil
end
=> Booting Thin
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/Users/justin/Projects/Soocial/webapp/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (dlopen(/usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle, 9): no suitable image found. Did find: (RuntimeError)
/usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle: mach-o, but wrong architecture - /usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle)
from /Users/justin/Projects/Soocial/webapp/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
from /Users/justin/Projects/Soocial/webapp/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:417:in
$ irb
>> require 'rubygems'
=> false
>> require 'pg'
LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle, 9): no suitable image found. Did find:
/usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle: mach-o, but wrong architecture - /usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle
from /usr/local/lib/ruby/gems/1.8/gems/pg-0.8.0/lib/pg.bundle
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from (irb):2
>>
@Juice10
Juice10 / compass-retina-sprites.scss
Created May 15, 2012 10:37 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
@mixin sprite-background($name, $folder, $sprite-width) {
$sprites: sprite-map("#{$folder}/*.png");
$sprites-retina: sprite-map("#{$folder}@2x/*.png");
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: inline-block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@Juice10
Juice10 / list-packages.py
Created October 23, 2015 13:52
List SoftLayer package ids for ordering via SoftLayer_Product_Order (in python). For ordering see: https://softlayer.github.io/python/create_server_from_template/
import SoftLayer
from pprint import pprint as pp
# HELP: please scroll to the very bottom to see how this works
class example():
def __init__(self):
self.client = SoftLayer.Client()
'''
An example of how to create a VSI from the SL python library
'''
from __future__ import print_function
import SoftLayer
from SoftLayer.managers.vs import VSManager
# For nice debug output:
from pprint import pprint as pp
@Juice10
Juice10 / .jshintrc
Last active December 19, 2015 23:59
{
"browser": true,
"node": true,
"predef": ["_", "Backbone", "define", "require", "$", "db", "app", "bn", "backfin", "d3", "confirm", "alert", "window", "document", "describe", "assert", "beforeEach","afterEach","it", "sinon", "module"],
"es5": true,
"undef": true,
"unused": true,
"evil": true,
"camelcase":true,
"bitwise":true,
@Juice10
Juice10 / billing_ruby_examples.rb
Created January 29, 2016 15:54
Billing Examples in Ruby
# please substitute your username and api key below,
# SoftLayer library will look to see if these global variables are set when making a connection
# more information here: https://github.com/softlayer/softlayer-ruby/blob/master/lib/softlayer/Config.rb#L11-L58
SL_API_USERNAME = "<your username here>"
SL_API_KEY = "<your apikey here>"
require 'softlayer_api' # Requires softlayer_api >= 3.2
require 'pp' # used to display results
# Create a client
version: '3'
services:
# name of our dockerized action
action:
# current directory is where our projects root
build: .
# docker hub account repo
# IMPORTANT: rename this to your docker hub username/project-name
image: juice10/openwhisk-ruby # rename me!
# expose ports