Skip to content

Instantly share code, notes, and snippets.

View MarkLavrynenko's full-sized avatar

Mark Lavrynenko MarkLavrynenko

View GitHub Profile
@MarkLavrynenko
MarkLavrynenko / SassMeister-input-HTML.html
Created December 22, 2014 18:37
Generated by SassMeister.com.
<ul>
<li class="item1">Text 1</li>
<li class="item2">Some text 2</li>
<li class="item3">Dota 2</li>
<li class="item4">Moon</li>
</ul>
@MarkLavrynenko
MarkLavrynenko / gist:bcbaf7c6a0ebffae8e99
Created March 27, 2015 19:19
NRZI & MLT-3 decoders
var code1 = "0010110111011111001001000010110011011100111001101"
var code2 = "1102201100200102001002011102220011020111000220110"
function decodeMessage(message) {
if (message.length != 49){
throw new Error("Bad length");
}
var ans = [];
for (var i = 1; i < message.length; ++i) {
ans[ans.length] = (message[i] != message[i-1] ? 1 : 0);
;(defmacro while (conditions &body body)
; '(loop while , condition
;)
(defun vector-product(x y)
(reduce '+ 0 (map 'list #'* x y)))
(setq a (list (list 1 2) (list 3 4)))
(setq b (make-array '(2 2) :initial-element 2))
; 2 2
(defclass tagged () ((tag :reader get-tag :writer set-tag :initform "Empty tag" :initarg :tag)))
(defclass 3d-point (tagged)
(
(x :reader get-x :writer set-x :initarg :x)
(y :reader get-y :writer set-y :initarg :y)
(z :reader get-z :writer set-z :initarg :z)
)
)
function SpaceShip(pilot, maxSpeed) {
this.pilot = pilot;
this.maxSpeed = maxSpeed;
}
SpaceShip.UPDATE_PILOT = "updatePilot";
SpaceShip.prototype.updatePilot = function (newAge, newSkill) {
var notifier = Object.getNotifier(this);
var self = this;
function Schedule (pretend, real) {
this.morning = pretend["morning"];
this.evening = pretend["evening"]
var morning = Symbol("morning")
var evening = Symbol("evening")
this[morning] = real["morning"];
this[evening] = real["evening"];
@MarkLavrynenko
MarkLavrynenko / gist:9bec7928d30a47507988
Last active August 29, 2015 14:17
Tree Traversal Lisp
;(load "1.lsp")
(setq tree '(1 (2 5) 6 (10 (14 (25 27) 40))))
(print tree)
(defun traverse-tree(tree depth)
(if (atom tree)
(progn (funcall func tree) (return-from traverse-tree))
)
(let ((list-len (length tree)))
;Macro study
(defun range-helper(x)
(if (= x 0)
(list x)
(cons x (range-helper (- x 1)))
)
)
(defun range (x)
(reverse (range-helper (- x 1)))
<html>
<head>
<title>English learner</title>
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="1.css">
</head>
<body ng-app="LearnerApp" ng-controller="WordCtr">
<div class="navbar navbar-static">
<div class="container">
<div class="navbar-header">
#from os import urandom
from random import randint
from time import *
__author__ = 'mlavrynenko'
smal_rsa_primes = [
2 , 3 , 5 , 7 , 11 , 13 , 17 , 19,
23 , 29 , 31 , 37 , 41 , 43 , 47 , 53,
59 , 61 , 67 , 71 , 73 , 79 , 83 , 89,
]