Skip to content

Instantly share code, notes, and snippets.

View mxrguspxrt's full-sized avatar

Margus Pärt mxrguspxrt

View GitHub Profile
@mxrguspxrt
mxrguspxrt / gist:4037427
Created November 8, 2012 07:42
riistvara-selftest2.txt
Küsimus 1
Õige
Hindamata
Flag question
@mxrguspxrt
mxrguspxrt / riistvara-selftest3.txt
Created November 8, 2012 08:04
riistvara-selftest3.txt
Küsimus 1
Õige
Hindamata
Flag question
@mxrguspxrt
mxrguspxrt / java2-home4.java
Created November 9, 2012 09:34
java2-home4.java
import java.util.*;
import java.util.regex.*;
/** Quaternions. Basic operations. */
public class Quaternion {
public double realPart;
public double i;
public double j;
public double k;
@mxrguspxrt
mxrguspxrt / java2-home5.java
Created November 19, 2012 19:30
java2-home5.java
import java.util.*;
public class Answer {
public String name;
public Answer firstChild;
public Answer nextSibling;
public static <T extends Object> void p(T s){
@mxrguspxrt
mxrguspxrt / java2-home6-test.java
Created November 29, 2012 22:20
java2-home6.java
import static org.junit.Assert.*;
import org.junit.*;
public class AnswerTest {
Answer.Graph g;
Answer.Vertex v1;
{
"font_face": "Bitstream Vera Sans Mono",
"font_size": 12,
"trim_trailing_white_space_on_save": true,
"draw_white_space": "selection",
"font_options": [ "gray_antialias" ],
"tab_size": 2,
"translate_tabs_to_spaces": true
class FormModel
extend ActiveModel::Naming
include ActiveModel::Conversion
include ActiveModel::Validations
def self.form_fields
@form_fields ||= []
end
@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;
}
}