Skip to content

Instantly share code, notes, and snippets.

Avatar
😂
https://lol.rogeruiz.com

Roger Steve Ruiz rogeruiz

😂
https://lol.rogeruiz.com
View GitHub Profile
@rogeruiz
rogeruiz / Ember.OldieLocation.js.coffee
Last active August 29, 2015 13:57
Oldie Location. Some old fashion HREF wrangling. Seriously, just a simple page refresh.
View Ember.OldieLocation.js.coffee
# For more information see: http://emberjs.com/guides/routing/
Vidz.Router.reopen
location: if Modernizr.history then 'history' else 'oldie'
# IE Ember.Location
# This new location type handles browser support for browsers without support
# for the History API. The Rails app can properly serve a page so when the History
# API isn't supported the Ember application doesn't bother setting a hash or pushing
# a history state. It simply navigates to that location by modifying the location.href
@rogeruiz
rogeruiz / customSelect.js
Created March 11, 2014 17:42
Custom Select AMD Module
View customSelect.js
define(function (require) {
var $ = require('jquery');
var $el = $('.js-custom-select');
var numEl = $el.length;
// Check if module should run.
if (!numEl) { return false; }
// Proceed with module execution
if ($el.data('map')) {
@rogeruiz
rogeruiz / jshintrc.js
Last active August 29, 2015 13:58
Some sane jshint
View jshintrc.js
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
View index.hbs
{{#each fruits}}
{{this}}
{{/each}}
{{draggable-list values=fruits}}
@rogeruiz
rogeruiz / api.js
Created June 21, 2014 18:19 — forked from fwielstra/api.js
View api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
View ember.js-with-google-maps.html
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.3/ember.js"></script>
<script src="//maps.googleapis.com/maps/api/js?sensor=false"></script>
</head>
<body>
<script>
@rogeruiz
rogeruiz / rAFader.js
Last active August 29, 2015 14:03
Simple fade rAF code, tweaked from MDN documentation
View rAFader.js
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
var start = null;
var d = $('.js-fader');
// Prep the element for animation
d.css('opacity', 0);
@rogeruiz
rogeruiz / SupportsAnimationMixin.js
Created July 8, 2014 11:48
Supports Animating Ember Mixin for use with gigafied's ember-animate
View SupportsAnimationMixin.js
;(function ($, Em, global, undefined) {
var App = global.App;
var rAF = global.Modernizr.prefixed('requestAnimationFrame', window) || function (cb) {
global.setTimeout(cb, 1000 / 60);
};
App.SupportsAnimationMixin = Em.Mixin.create({
classNames: ['supports-animation'],
@rogeruiz
rogeruiz / social.js.coffee
Created August 4, 2014 21:52
EmberJS Social Initializer for Controllers [Sketch]
View social.js.coffee
Social = Em.Object.extend
title: null
url: null
image: null
description: null
facebook: (->
endpoint = 'https://www.facebook.com/dialog/feed?'
return endpoint + Em.$.param
app_id: Vidz.get('facebookAppId')
display: 'popup'
@rogeruiz
rogeruiz / breakpoints.scss
Last active August 29, 2015 14:08
MediaQuery with Breakpoint Support & Grid helpers
View breakpoints.scss
// Breakpoints relative to the site design
$list-bp:
'small',
'small-2',
'medium',
'large',
'large-2',
'large-3';
$watch-page-height: 72px + 82px + 10px;