Skip to content

Instantly share code, notes, and snippets.

View shohey1226's full-sized avatar

Shohei Kameda shohey1226

View GitHub Profile
@shohey1226
shohey1226 / gist:5559959
Created May 11, 2013 13:25
before backbone.js
jQuery(function($) {
$(document).ready(function() {
$('#search').click(function(){
mainSearch();
});
$('#submit').click(function(){
var knowledge = {};
knowledge.know = $('#know').val();
@shohey1226
shohey1226 / gist:5559969
Last active December 17, 2015 05:48
after backbone.js
(function(){
//=========================================================================
// To avoid the conflict with Mojolicious's template
//=========================================================================
// _.templateSettings = {
// evaluate: /\{\{([\s\S]+?)\}\}/g,
// interpolate: /\{\{=([\s\S]+?)\}\}/g
// };
app.routers.AppRouter = Backbone.Router.extend({
routes: {
"": "home",
"employees/:id": "employeeDetails",
"employees/:id/reports": "reports",
"employees/:id/map": "map"
},
initialize: function () {
app.models.Employee = Backbone.Model.extend({
initialize:function () {
this.reports = new app.models.ReportsCollection();
this.reports.parent = this;
},
sync: function(method, model, options) {
if (method === "read") {
app.adapters.employee.findById(parseInt(this.id)).done(function (data) {
app.views.HomeView = Backbone.View.extend({
initialize: function () {
this.searchResults = new app.models.EmployeeCollection();
this.searchresultsView = new app.views.EmployeeListView({model: this.searchResults});
},
render: function () {
this.$el.html(this.template());
$('.scroller', this.el).append(this.searchresultsView.render().el);
sub startup {
my $self = shift;
$self->types->type(json => 'application/json; charset=utf-8');
#!/usr/bin/env perl
use Statistics::R;
my $R = Statistics::R->new();
$R->set('x', 5);
$R->run(q`y <- x^2`);
my $output_value = $R->get('y');
print "y = $output_value\n";
$R->stop();
'use strict';
describe('Testing Services', function () {
// Required setup for AngualarJS
beforeEach(module('frontieApp'));
var myOrder;
beforeEach(inject(function(_myOrder_){
myOrder = _myOrder_;
}));
.factory('myOrder', function () {
var order = {};
return {
init: function () {
order = {};
},
setStock: function(stock){
order.stock = stock;
},
getStock: function(){
---
- hosts: servers
user: root
tasks:
- name: add user
user: name=kamesho
- authorized_key: user=kamesho key="{{ lookup('file', '/Users/kamesho/.ssh/id_rsa.pub') }}"