Skip to content

Instantly share code, notes, and snippets.

View pixelhandler's full-sized avatar

Billy Heaton pixelhandler

View GitHub Profile
@pixelhandler
pixelhandler / ember-rails-scaffold.md
Last active August 20, 2021 23:06
Scaffold for a browser app build with Ember.js, Rails, Ember.Data

Scaffold for a browser app build with Ember.js, Rails, Ember.Data

Journal App

This is a scaffold for setting up: an API with Rails and the ember-rails gem, persistence with Ember.Data, and a browser app using Ember.js

See source code on GitHub: pixelhandler/journal.

@pixelhandler
pixelhandler / Gemfile
Created September 23, 2013 22:18
Source to complete tutorial at http://hashrocket.com/blog/posts/setting-up-an-ember-app-with-a-rails-backend I used ember-data-canary and ember-canary versions to get the data to work
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
group :doc do
@pixelhandler
pixelhandler / Ember-Component-Custom-Select-Box.md
Last active December 21, 2015 14:39
Ember.js component for a custom select box which can have a custom visual design and yet keep all standard browser behavior for selecting options. This `faux-select` is an Ember.Component which follows the intention of W3C web component draft for a "custom element"

Ember Components Example

  • With the select element using an opacity of zero (0), the element can have a custom background, and when clicking on the element the hidden select box still behaves normally (browser's default behavior)
  • The element with the class .faux-select-selected needs javascript functionality which updates the content binding to the value that is selected using the invisble select box (on change).

Steps to build a custom "faux" select box

(clone the emberjs/starter-kit to get started, see the components branch on this clone of starter kit...https://github.com/Ember-SC/starter-kit/commits/components)

  1. Start with removing the default index template/model from the emberjs/starter-kit
@pixelhandler
pixelhandler / jquery.imagesloaded.js
Last active December 20, 2015 07:28 — forked from desandro/jquery.imagesloaded.js
images loaded plugin
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// mit license. paul irish. 2010.
// webkit fix from Oren Solomianik. thx!
// callback function is passed the last image to load
// as an argument, and the collection as `this`
@pixelhandler
pixelhandler / notes-ember-sc-state-manager-talk.md
Last active December 19, 2015 22:19
Notes and links for talk "Sanely Edit an HTML Doc in a Browser with Ember.StateManager" presented at Ember-SC July Meetup.
@pixelhandler
pixelhandler / pre-push.sh
Last active September 25, 2025 11:25
Git pre-push hook to prevent force pushing master branch
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@pixelhandler
pixelhandler / async.spec.js
Created July 19, 2012 17:33
Async Jasmine test
describe("Async Jasmine test", function () {
beforeEach(function () {
this.Model = Backbone.Model;
this.server = sinon.fakeServer.create();
this.server.respondWith(
'GET',
'/api/model/12345',
[
200,
@pixelhandler
pixelhandler / bootstrap.js
Created February 26, 2012 02:12
Product API example using Backbone.js Models, Views and Collections
// bootstrap
PX.app = new PX.App();
Backbone.history.start();
var application_root = __dirname,
express = require("express"),
path = require("path"),
mongoose = require('mongoose');
var app = express.createServer();
// database
mongoose.connect('mongodb://localhost/ecomm_database');
@pixelhandler
pixelhandler / index.html
Created October 17, 2011 09:00
Module Constructor
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>QUnit Test Suite</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css" type="text/css" media="screen">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script>
</head>
<body>