Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Dice Roll Game</title>
</head>
<body>
<h1>Dice Roller</h1>
<div class="dice" id="first-die"></div>
<div class="dice" id="second-die"></div>
<button id="roll-dice">Roll the Dice</button>
<!DOCTYPE html>
<html>
<head>
<title>Tiny Turtle</title>
<script src="https://toolness.github.io/tiny-turtle/tiny-turtle.js"></script>
</head>
<body>
<h1>Tiny Turtle</h1>
<canvas></canvas>
</body>
@styliii
styliii / csv_writer.rb
Last active August 10, 2016 20:46
An example of composition
class ReportBuilder
def csv_report(objects, adapter, opts = {})
writer = CsvWriter.new(adapter)
objects.each do |object|
writer.write_object(object, opts)
end
writer.to_s
end
@styliii
styliii / market_indexes_feed_item
Created April 13, 2015 07:56
market_indexes_feed_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rlContainer"
style="?feedCardView"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/llContainer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
package com.finnerds.wealthnow.adapters;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
@styliii
styliii / heroku_sanxbox.rake
Last active August 29, 2015 14:07
Heroku Setup for Sandbox Environment
# encoding: utf-8
namespace :dev do
namespace :heroku do
HEROKU_CMD = "GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' /usr/bin/heroku"
desc "initialize heroku instance"
task :init => :environment do
STDOUT.puts "What do you want to call your environment?".colorize(:yellow)
input = STDIN.gets.strip
exit if input.blank?
=> #<User id: 110, email: "[email protected]", crypted_password: "$2a$10$oWWIP/cyDCkdjSAuabsWd.4LmITNER2.snHZNs1n9c8R...", salt: "y85TW1tozJXwXqxWsU7L", created_at: "2014-01-29 22:59:07", updated_at: "2014-01-29 22:59:08", remember_me_token: nil, remember_me_token_expires_at: nil, reset_password_token: nil, reset_password_token_expires_at: nil, reset_password_email_sent_at: nil, last_login_at: "2014-01-29 23:32:53", last_logout_at: nil, last_activity_at: "2014-01-31 16:50:57", first_name: "jaimel", last_name: "gauda", phone_number: "3144948435", zendesk_user_id: "605708293", last_login_from_ip_address: "24.6.52.99", used_free_months: 0, agree_to_tos: true, lead_id: nil, conversion_token: "">
irb(main):005:0> user.invoices
[Shard: slave_0] Invoice Load (1.3ms) SELECT `invoices`.* FROM `invoices` WHERE `invoices`.`user_id` = 110
=> #<ActiveRecord::Associations::CollectionProxy [#<Invoice id: 105, order_id: 112, user_id: 110, foreign_key: "in_3Ov9pbVLvRGBRg", aasm_state: "shipped", created_at: "
@styliii
styliii / zeus.json
Created December 12, 2013 23:14
current zeus setup
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"console": ["c"],
"generate": ["g"]
require 'zeus/rails'
class CustomPlan < Zeus::Rails
# def my_custom_command
# # see https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md
# end
def spec(argv=ARGV)
# disable autorun in case the user left it in spec_helper.rb
RSpec::Core::Runner.disable_autorun!
{
"command": "ruby -rubygems -r./custom_plan -eZeus.go",
"plan": {
"boot": {
"default_bundle": {
"development_environment": {
"prerake": {"rake": []},
"console": ["c"],
"generate": ["g"]