Skip to content

Instantly share code, notes, and snippets.

View kosz's full-sized avatar

Cosmin kosz

  • Bucharest / Toronto
View GitHub Profile
@kosz
kosz / tmux.md
Created January 3, 2017 13:59 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

# This class facilitates writting Angular Controllers as OOP style classes rather than
# declaring an expensive method everytime the constructor is ran
# It MUST be extended by any Controller written as a class.
# That class MUST implement a constructor and call it's super
# NOTE: I have second doubts about this because
# 1) it doesn't do things the angular way,
# 2) it's coffeescript specific more or less
# 3) it requires specific code to be written in the implementing classes
class Api::PeopleController < ApplicationController
def index
@people = Person.all
render json: @people.map { |p|
{
full_name: "#{p.fname} #{p.lname}",
id: p.id
}
}
button.btn.btn-default.btn-xs
span.glyphicon(
ng-click="toggleOpen()"
ng-class="{'glyphicon-chevron-down': !entry.open, 'glyphicon-chevron-up': entry.open}"
)
button.btn.btn-default.btn-xs(
ng-click="testMethod($event)"
)
span.glyphicon.glyphicon-remove
-> index.html(.erb)
<div ng-controller="TasksController">
<div ng-repeat="task in tasks" style="border:1px solid black; margin: 2px 2px 2px 2px; padding: 2px 2px 2px 2px;">
{{task.name}}
<button ng-click="open()">Edit</button>
<modal/>
</div>
</div>
###
runtime in index.html <script> tag
angular.element(document).ready(function() {
angular.module('Movies', []);
angular.module('Movies').controller('MosaicController',
function ($scope, $http) {
$scope.teststuff = "hello"
calendar.jade
div(ng-include='\'partials/navbar.html\'')
.jumbotron
h1
| Calendar
p.lead
br
<!-- Proper Rails + AngularJS syntax -->
<%= f.text_field :title, :class=> "form-control",
"ng-model" => "title", "ng-change" => "changeTitle(title)" %>
<!-- this will cause a rails error -->
<%= f.text_field :title, :class=> "form-control",
:ng-model => "title", :ng-change => "changeTitle(title)" %>
class Example extends Backbone.View
template: () ->
# render the template here and return
# a text object containing the template text
initialize: () ->
@render()