Stefan Huska kelso

View copy_prices.php
1 2 3 4 5 6 7 8 9 10
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
 
$result = mysql_query("SELECT price, product_id FROM product_attributes");
 
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo "price: ".$row[0]
echo "product_id".$row[1]
}
View campaigns_controller_spec.rb
1 2 3 4 5 6 7 8 9 10
require 'spec_helper'
 
describe CampaignsController do
let(:user){ create(:admin_user) }
 
before(:each) do
sign_in user
end
 
describe "GET #index" do
View css_resources.md

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
View rails_resources.md

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
View 0_reuse_code.js
1 2
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View output
1 2 3 4 5 6 7 8 9 10
$ vagrant up development
[development] VM already created. Booting if it's not already running...
[development] Clearing any previously set forwarded ports...
[development] Forwarding ports...
[development] -- 22 => 2222 (adapter 1)
[development] -- 3000 => 61000 (adapter 1)
[development] Creating shared folders metadata...
[development] Clearing any previously set network interfaces...
[development] Preparing network interfaces based on configuration...
[development] Running any VM customizations...
View ajax.js
1 2 3 4 5 6 7 8 9 10
$.ajax( "example.php" )
.done(function() {
alert( "success, juppii" );
})
.fail(function() {
alert( "error, sakra" );
})
.always(function() {
alert( "complete" );
});
View application_controller.rb
1 2 3 4 5 6 7 8 9 10
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
 
before_action :set_locale
before_action :set_cart
 
def set_cart
@cart = ShoppingCart.new(session)
View Account.rb
1 2
has_many :relationships
has_many :people, through: :relationships
Something went wrong with that request. Please try again.