Skip to content

Instantly share code, notes, and snippets.

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

Oleh Makarov lgmkr

🏠
Working from home
View GitHub Profile
@lgmkr
lgmkr / install-mit-schema-for-SICP.md
Created December 30, 2017 11:30 — forked from deepak/install-mit-schema-for-SICP.md
installing MIT-scheme for doing SICP

installing MIT Schema

The SICP page recommends MIT scheme,
so that is what we will use

to install it, on Apple OSX using Homebrew:

  brew tap x11
  brew cask install xquartz
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do

Figure out a good standard for how to use the HTTP response codes in a 'truly RESTful' (Now called 'Hypermedia API' apparently) way.

Summary

iTerm2 – Useful Shortcuts (Mac OS X)

with a hat tip to Sublime Text 2 Shortcuts

The Awesome

⌘; autocomplete
⌘⌥B instant replay
⌘⌥E search across all tabs

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

module HashConverter
class << self
def to_underscore hash
convert hash, :underscore
end
def to_camel_case hash
convert hash, :camelize, :lower
end
def convert obj, *method
case obj
@lgmkr
lgmkr / backbone-tutorial.js
Created August 30, 2012 15:42 — forked from jacob414/backbone-tutorial.js
Minimal example of data handling in Backbone.js
/* Scaled-down Backbone.js demonstration
* By Jacob Oscarson (http://twitter.com/jacob414), 2010
* MIT Licenced, see http://www.opensource.org/licenses/mit-license.php */
$(function() {
window.ulog = function(msg) { $('#log').append($('<div>'+msg+'</div>')); }
// Faking a little bit of Backbone.sync functionallity
Backbone.sync = function(method, model, succeeded) {
ulog('<strong>'+method + ":</strong> " + model.get('label'));
if(typeof model.cid != 'undefined') {
@lgmkr
lgmkr / backbone.rails.js
Created August 28, 2012 15:15 — forked from trydionel/backbone.rails.js
Makes Backbone.js play nicely with default Rails setup
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@lgmkr
lgmkr / gist:3415106
Created August 21, 2012 12:50 — forked from ValeriiVasin/gist:1548808
[javascript patterns] Javascript inheritance.
var inherit = (function () {
var F = function () {};
return function (C, P) {
F.prototype = P.prototype;
C.prototype = new F();
C.uber = P.prototype;
C.prototype.constructor = C;
};
}());
@lgmkr
lgmkr / patterns.js
Created August 21, 2012 12:49
JavaScript Patterns
/**
* @memberOf __module
* @type module
*/
var module = (/** @constructor */ function() {
function privateMethod() {
...
}