Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.
CS183: Startup—Notes Essay—The Challenge of the Future
Purpose and Preamble
<? | |
# MIT license, do whatever you want with it | |
# | |
# This is my invoice.php page which I use to make invoices that customers want, | |
# with their address on it and which are easily printable. I love Stripe but | |
# their invoices and receipts were too wild for my customers on Remote OK | |
# | |
require_once(__DIR__.'/../vendor/autoload.php'); |
.git | |
.gitignore | |
README.md | |
# | |
# OS X | |
# | |
.DS_Store | |
.AppleDouble | |
.LSOverride |
#routes.rb | |
get "blog/category/:category/" => "posts#by_category", as: :post_category | |
get "blog/category/:category/index.html" => "posts#by_category" | |
get "blog/page-:page/" => "posts#index", as: :blog | |
get "blog/page-:page/index.html" => "posts#index" | |
get "blog/:slug/" => "posts#by_slug", as: :post_slug | |
get "blog/:slug/index.html" => "posts#by_slug" | |
get "blog" => "posts#index", as: :blog | |
get "blog/index.html" => "posts#index" |
# define a method to run rake tasks | |
def run_rake(task, options={}, &block) | |
rake = fetch(:rake, 'rake') | |
rails_env = fetch(:rails_env, 'production') | |
command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}" | |
run(command, options, &block) | |
end | |
Here is an essay version of my class notes from Class 1 of CS183: Startup. Errors and omissions are my own. Credit for good stuff is Peter’s entirely.
CS183: Startup—Notes Essay—The Challenge of the Future
Purpose and Preamble
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
class GalleryImagesController < ApplicationController | |
def rotate | |
@image = GalleryImage.find(params[:id]) | |
rotation = params[:deg].to_f | |
rotation ||= 90 # Optional, otherwise, check for nil! | |
@image.rotate!(rotation) | |
flash[:notice] = "The image has been rotated" | |
end |