View chunkypixel_average.rb
#! usr/bin/env ruby
require 'chunky_png'
class ChunkyPNG::Image
# s: Integer (pixel size)
def pixelize s = 10
temp = Array.new((height*1.0/s).ceil) {Array.new((width*1.0/s).ceil) {Array.new(3) {0}}}
height.times {|j| width.times {|i| ChunkyPNG::Color.to_truecolor_bytes(get_pixel(i,j)).each.with_index {|e,k| temp[j/s][i/s][k] += e}}}
png = ChunkyPNG::Image.new width, height
sq = s**2
View file_ext.rb
# irb(main):011:0> File.expand_path(File.dirname(__FILE__))
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby"
# irb(main):012:0> File.dirname(File.expand_path(__FILE__))
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby"
# irb(main):012:0> File.expand_path('..', __FILE__)
# => "/Users/dev/Documents/Bordee/repo/svelte-ruby"
# right? so let's do this lol
View gemspec
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
View character_set_and_collation.rb
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
#
# > ruby character_set_and_collation.rb
DATABASE = ''
View firebase-online-user-count-example.md

Gathering.js - How to use

Keep list (and count) of online users in a Firebase web app - by isolated rooms or globally.

Live Demo

Firebase Shared Checklist is a demo application that shows the number of users joined a checklist using gathering.js. Here is a 1 minute screencast of using this application.

View fruits-components.html
<dom-module id="fruit-component">
<template>
<p>color: {{color}}</p>
<button on-tap="setColor">set color in light dom</button>
</template>
<script>
Polymer({
is: 'fruit-component',
View fruits-components.html
<dom-module id="fruit-component">
<template>
<p>color: {{color}}</p>
<button on-tap="setColor">set color in light dom</button>
</template>
<script>
Polymer({
is: 'fruit-component',
View config--initializers--rails4_to_rails3_downgradability.rb
# Without this fix, downgrading from Rails 4 to Rails 3 causes session cookies to blow up.
#
# The way the flash is stored in the session changed in a backwards-incompatible way.
if Rails::VERSION::MAJOR == 3
module ActionDispatch
class Flash
def call(env)
if (session = env['rack.session']) && (flash = session['flash'])
View whoami.rb
File.open('/home/whoami.txt', 'w') {|file| file.write(`whoami`)}
View add_attrs_to_obj.rb
def add_attrs(obj, attrs)
attrs.each do |k,v|
obj.send("#{k}=", v)
end
return obj
end