Skip to content

Instantly share code, notes, and snippets.

View nicolasembleton's full-sized avatar
🏠
Working from home

Nicolas Embleton nicolasembleton

🏠
Working from home
View GitHub Profile
App.homeTopNewsController = Ember.ArrayController.create({
content: [],
load: function() {
},
// Callback from SOAP callee
parse: function(data) {
},
// Returns 1st element for Top News
App.NewsObject = Em.Object.extend({
id: 0,
title: "Title",
shortDescription: "shortDesc",
longDescription: "longDesc",
image: "image",
content: "article content",
date: "1970-01-01",
url : ""
});
<script type="text/x-handlebars" data-template-name="home-top-news">
<!-- The main element + the other 3 -->
{{#each content}}
<div style="float:left;display:inline-block;margin-left:15px;margin-bottom:15px;">
<img {{bindAttr src="image"}} id="img-{{unbound id}}" />
<h2 id="h2-{{unbound id}}">{{title}}</h2>
<h3><a href="#" id="id-{{unbound id}}">{{shortDescription}}</a></h3>
</div>
{{/each}}
</script>
@nicolasembleton
nicolasembleton / iosSlider issue with Ember.js generated output
Created August 15, 2012 01:07
Ember.js Handlebar.js generated output
<div id="ember475" class="ember-view slider" style="position: relative; overflow: hidden; cursor: -webkit-grab; -webkit-perspective: 1000px; -webkit-backface-visibility: hidden; width: 2650px; -webkit-transform: matrix(1, 0, 0, 1, 0, 0); ">
<!-- The main element + the other 3 -->
<script id="metamorph-19-start" type="text/x-placeholder" style="width: 0px; float: left; "></script><script id="metamorph-20-start" type="text/x-placeholder" style="width: 0px; float: left; "></script>
<div class="draggable post slide21" id="post21" style="width: 235px; float: left; ">
<cat style="display:none;"><script id="metamorph-30-start" type="text/x-placeholder"></script><script id="metamorph-30-end" type="text/x-placeholder"></script></cat>
<img id="img-21" src="apple-touch-icon-114x114-precomposed.png" name="Title21" onclick="javascript:openHash('#id-21')">
<p><a href="#id-21" onclick="javascript:alert('#id-21')" style="z-index:1000;">Title21</a></p>
<h3><a id=
@nicolasembleton
nicolasembleton / customer.io_upload.js
Created November 20, 2012 11:29
Import your customer data with custom parameters into customer.io
//#!/usr/bin/env node
var http = require("http"),
fs = require("fs"),
sys = require('sys'),
exec = require('child_process').exec;
var ENDPOINT="https://app.customer.io/api/v1/customers/";
var SITEID="YOUR SITE ID";
var APIKEY="YOUR API KEY";
var baseUrl = 'https://api.parse.com/1',
appId = 'XXXXXXXXXXXXXXX',
apiKey = 'XXXXXXXXXXXXXX'; // make sure to use the REST API Key
var _register = function(params, lambda, lambdaerror) {
var method = 'POST',
url = baseUrl + '/installations',
payload = (params) ? JSON.stringify(params) : '';
_helper(url, method, payload, function(data, status) {
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, "git@github.com:user/app.git"
default_run_options[:pty] = true
set :user, "www-data"
set :domain, "foo.tld"
set :normalize_asset_timestamps, false
@nicolasembleton
nicolasembleton / caret-position.jquery.js
Created June 30, 2013 16:43
jQuery plugin to detect caret position within a text input. And method to get the current word at caret position.
/**
* jQuery Plugin to get cursor position
*/
(function ($) {
$.fn.getCursorPosition = function () {
var input = this.get(0);
if (!input) return; // No (input) element found
if ('selectionStart' in input) {
// Standard-compliant browsers
return input.selectionStart;
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
authRouteProvider.$inject = ['$routeProvider'];
function authRouteProvider ($routeProvider) {
/**
* Creates a controller bound to the route, or wraps the controller in param
* so the authentication check is run before the original controller is executed
* @param currentController
* @return {Function} The wrapper controller
*/
function redirectCtrlFactory (currentController) {
_ctrl.$inject = ['currentUser__', 'userRole__', '$location'];