Skip to content

Instantly share code, notes, and snippets.

View unamashana's full-sized avatar

Hana Mohan unamashana

View GitHub Profile
SB.Models.Ticket = Backbone.Model.extend(
name: "ticket"
urlRoot: "/tickets"
)
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
== <link rel="shortcut icon" href="/favicon.ico" />
== <meta name="viewport" content="width=device-width, initial-scale=1.0" >
%title
= @page_title || "SupportBee"
= include_stylesheets :common, :app, :desktop
= include_javascripts :common, :app_assets, :app, :desktop
{
"total":1,
"current_page":1,
"per_page":10,
"total_pages":1,
"tickets":[
{
"id":1,
"subject":"First Ticket Subject",
...
var Workspace = Backbone.Router.extend({
routes: {
"help": "help", // #help
"search/:query": "search", // #search/kiwis
"search/:query/p:page": "search" // #search/kiwis/p7
},
help: function() {
...
var object = {};
_.extend(object, Backbone.Events);
object.on("alert", function(msg) {
alert("Triggered " + msg);
});
object.trigger("alert", "an event");
success: function( response ) {
if( response.products ) {
$.each( response.products,
function( index, value ) {
$( 'div[name="'+value.product_id+'"]' ).html( value.price );
}
);
}
}
$.ajax({
type: "GET",
url: '/update_url',
data: "id=" + id,
success: function(data) {
$('#summary').html(data);
});
@unamashana
unamashana / 0_reuse_code.js
Created November 21, 2013 05:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# This will compile everything ending with .html.handlebars into
# a global namespace SB.Views.Templates using the template_function
# Handlebars.template
template_extension: 'html.handlebars'
template_function: Handlebars.template
template_namespace: SB.Views.Templates
# Don't compress assets
compress_assets: off
require 'rubygems'
require 'rb-inotify'
require 'sqlite3'
require 'active_record'
require 'mail'
require 'log4r'
include Log4r
MYLOG = Logger.new 'mylog'
file = FileOutputter.new('fileOutputter', :filename => 'hsi_notifications.log', :trunch => false)