Skip to content

Instantly share code, notes, and snippets.

[
{
"id": 105142,
"avatar": "test",
"commenter": "Test",
"text": "test",
"parent": null,
"created": "2015-03-20T17:21:33.013+01:00"
},
{
angular.module('starter')
.controller('NewsCtrl', function($scope, content, $cordovaSocialSharing, $sce, $ionicModal){
$scope.news = content;
content.getList('comments').then(function (comments) {
$scope.comments = comments;
});
$ionicModal.fromTemplateUrl('templates/comments.html', {
scope: $scope,
@robypez
robypez / gist:d29c5fe5dda4a65c6d59
Created December 31, 2014 17:38
Angular Constant
angular.module('app.config',[])
.constant('DB_CONFIG', {
name: 'nautica',
tables: [
{
name: 'Questions',
columns: [
{name: 'id', type: 'INTEGER PRIMARY KEY NOT NULL'},
{name: 'text', type: 'TEXT'},
{name: 'exam_type', type: 'TEXT'},
@robypez
robypez / gist:3ee7b6d1f1ec34d53ec8
Created December 10, 2014 08:58
Angular Structure
app/
app.js
Home/
_home.haml
HomeController.coffee
HomeEntryDirective.coffee
HomeService.coffee
Login/
_login.haml
LoginController.coffee
/* global window, document, $ */
;(function (window, document, undefined) {
'use strict';
window.headerManager = (function () {
var script,
@robypez
robypez / gist:8966677
Created February 12, 2014 23:24
demo
%tr.odd.gradeX
%td= product.id
%td= product.brand
%td= product.name
%td= product.published_at
%td
%span.label.label-primary= product.category.try(:name)
%td
- if product.product_review.present?
%span.label.label-primary Prova
@robypez
robypez / gist:8113216
Created December 24, 2013 13:15
Ajax
$(document).on "ajax:success", ".img_action_remove", (e) ->
$(e.currentTarget).closest("li").remove()
@robypez
robypez / gist:7895742
Created December 10, 2013 18:40
Question!
Name all the 7 (or 8) routes exposed by the resources keyword in the routes.rb file. Also name the 4 named routes, and how the request is routed to the controller/action.
What is REST and how does it relate to the resources routes?
What's the major difference between model backed and non-model backed form helpers?
How does form_for know how to build the <form> element?
What's the general pattern we use in the actions that handle submission of model-backed forms (ie, the create and udpate actions)?
How exactly do Rails validations get triggered? Where are the errors saved? How do we show the validation messages on the user interface?
What are Rails helpers?
What are Rails partials?
When do we use partials vs helpers?
When do we use non-model backed forms?
@robypez
robypez / gist:7288032
Created November 3, 2013 09:29
Blackjack problem
class Hand
attr_reader :owner, :hand, :value
def initialize(owner, hand = [])
@hand = hand
@owner = owner
@value = 0
end