Skip to content

Instantly share code, notes, and snippets.

View mxrguspxrt's full-sized avatar

Margus Pärt mxrguspxrt

View GitHub Profile
@mxrguspxrt
mxrguspxrt / yo-mvc.js
Last active August 29, 2015 14:02
just saving
var Yo = function(){}
Yo.Application = function(){
this.Router = null;
this.Controllers = {};
this.Views = {};
this.Repositories = {};
this.Models = {};
}
@mxrguspxrt
mxrguspxrt / gist:4644d0397b89bb8d2ff1
Created October 4, 2014 16:27
Ember HashTransform for Grapho,
App.HashTransform = DS.Transform.extend({
deserialize: function(serialized) {
return serialized || {}
},
serialize: function(deserialized) {
return deserialized || {}
}
});
@mxrguspxrt
mxrguspxrt / controller.js
Last active August 29, 2015 14:07
Creating assocations
// you have to have assocations defined and in view you can check isDirty
// it is automatically pushed to your assocation (in our case order)
actions: {
addOrderProduct: function() {
var order = this.get("controllers.order.model");
var orderProduct = this.store.createRecord("orderProduct", {order: order});
return orderProduct;
}
}
.menu a {
display: block;
}
.form-control {
margin-bottom: 20px;
width: 100%;
}
.form-control .fa {
@mxrguspxrt
mxrguspxrt / Preferences.sublime-settings
Last active August 29, 2015 14:15
My Sublime settings
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by file type specific settings.
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"detect_indentation": false
}
@mxrguspxrt
mxrguspxrt / reio-on-omo.js
Created June 16, 2015 10:23
reio-on-omo.js
var App = {
Init: function (data) {
$("#devicetypes").change(App.DeviceTypeChanged);
$("#makes").change(App.MakeChanged);
$("#models").change(App.ModelChanged);
$(".conditions").change(App.ConditionChanged);
App.PopulateDefaulListValues(1, 13);
@mxrguspxrt
mxrguspxrt / chunky_png.rb
Created November 24, 2011 20:38
autocrop, colorize, solid color
# Usage:
#
# image1 = ChunkyPNG::Image.from_file('vase.png')
# image1.colorfy!(:color => "ff0000")
# image1.save 'changed_red.png'
#
# image2 = ChunkyPNG::Image.from_file('vase.png')
# image2.colorfy!(:color => "ff0000", :solid => true)
# image2.save 'only_red.png'
#
# atm its so for my class
class ApplicationController < ActionController::Base
extend ActiveSupport::Concern
protect_from_forgery
#enable_authorization
respond_to :html, :xml, :json
@mxrguspxrt
mxrguspxrt / gist:1539073
Created December 30, 2011 09:55
replace method object handled like a object
# example
class A
def a
puts "a"
end
def b
puts "b"
end
end
@mxrguspxrt
mxrguspxrt / help.rb
Created January 1, 2012 14:54
Undrestanding yield and scopes
# what should I do, that a() would run in context of class A, not give "block in <main>': undefined method `a' for main:Object (NoMethodError)"
class A
def a
puts "a"
end
end
class B