Skip to content

Instantly share code, notes, and snippets.

node_modules
@jamesflorentino
jamesflorentino / style.css
Last active February 22, 2022 01:31
Using 2x images as sprite sheet.
/* sprite is 500x500 by default */
.sprite {
background: url(sprites.png) top left no-repeat;
}
.sprite.sprite-user {
background-position: 0px -100px;
}
/* Use the @2x sprite (1000x1000) only if the browser is capable of high-res display */
App = Ember.Application.create();
App.Router.map(function() {
this.route('post', { path: '/:post_id' });
});
posts = [{
id: 0,
title: "Rails is omakase",
body: "There are lots of à la carte software environments in this world."
var App = Ember.Application.create();
App.ApplicationController = Ember.Controller.extend({
bag: ['Protein Shake', 'Training Shoes', 'Steroids', 'Insulin Shots'],
home: [],
actions: {
leaveAtHome: function(items) {
items.forEach(function(item) {
this.get('bag').removeObject(item);
this.get('home').addObject(item);
var _dictionary = {
'rock,scissors': 'Rock',
'rock,paper': 'Paper',
'scissors,paper': 'Scissors'
};
function compare(a, b) {
var result;
if (a === b) {
result = 'Result is a tie';
@jamesflorentino
jamesflorentino / compare.js
Created August 18, 2013 04:11
Bato bato pik
function compare(choice1, choice2) {
if (choice1 === choice2) {
return 'Result is a tie';
} else if (choice1 === 'rock') {
if (choice2 === 'scissors') {
return 'Rock wins';
} else if (choice2 === 'paper') {
return 'Paper wins';
}
} else if (choice1 === 'paper') {
@jamesflorentino
jamesflorentino / client.js
Last active December 20, 2015 14:49
client.js
/** client.js **/
var https = require('https');
var url = require('url');
function Client() {}
/**
* All initialization code should be here.
*/
Client.prototype.initialize = function() {};
//To get the GPS coordinate from the mobile browser:
navigator.geolocation.getCurrentPosition(function(location) {
// location.coords.longitude;
// location.coords.latitude;
});
//To let the server receive data, you'll need to create a service that will handle your json data.
//e.g. in node.js/express
// Basic entity-component closure
function Component(api) {
return function(entity) {
for(var key in api) {
if (api.hasOwnProperty(key)) {
entity[key] = api[key];
}
}
}
}
// Basic entity-component closure
function Component(api) {
return function(entity) {
for(var key in api) {
if (api.hasOwnProperty(key)) {
entity[key] = api[key];
}
}
}
}