Skip to content

Instantly share code, notes, and snippets.

master_char='🗻'
improvement_char='🌀'
bug_char='🐛'
experiment_char='🎇'
documentation_char='📓'
feature_char='💡'
eval-var() {
eval echo $1
}
@welldan97
welldan97 / clean_repo.sh
Last active January 2, 2016 09:09
Clean up git repo
#!/bin/bash
main(){
reset_branch
remove_all_branches_besides_current
remove_all_stashes
remove_all_uncheked_files
}
reset_branch(){
<div data-panorama="images/panorama.jpg"></div>
@welldan97
welldan97 / simple_panorama.coffee
Last active December 17, 2015 22:39
Simple panorama with three.js.
$ ->
class Panorama360
constructor: (container) ->
$container = $(container)
source = $container.data("panorama")
@camera = new THREE.PerspectiveCamera(70, $container.width() / $container.height(), 1, 1100)
@camera.target = new THREE.Vector3(0, 0, 0)
@scene = new THREE.Scene()
sphereGeometry = new THREE.SphereGeometry(500, 60, 40)
class VehicleEmail
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :recipients, :subject, :message, :vehicle_id
validates_presence_of :subject, :message, :vehicle_id, :recipients
def deliver_from(admin_user)
if valid?
@welldan97
welldan97 / system-wide-clipboard.zsh
Created March 10, 2013 09:51
Zsh copy & paste system wide for OS X, like in emacs
pb-kill-line () {
zle kill-line
echo -n $CUTBUFFER | pbcopy
}
pb-kill-whole-line () {
zle kill-whole-line
echo -n $CUTBUFFER | pbcopy
}
...
%%% Каждый раздел (\section) с новой страницы
\let\stdsection\section
\renewcommand\section{\newpage\stdsection}
%%% В введении нумерация подразделов идёт с буквой «В» (например В.1)
\makeatletter
\renewcommand\thesubsection{\ifnum\c@section=0{В.\arabic{subsection}}\else{\arabic{section}.\arabic{subsection}}\fi}
\makeatother
1> Products = [{pen, 5, 10}, {pencil, 3, 4}].
[{pen,5,10},{pencil,3,4}]
2> [{pen, PenQuantity, PenCost},_] = Products.
[{pen,5,10},{pencil,3,4}]
3> PenQuantity.
5
4> PenCost.
fib(4) = fib(3) + fib(2)
таак, а
fib(3) = fib(2) + fib(1)
ага,
fib(2) = fib(1) + fib(0)
о, теперь всё есть
fib(0) = 1
fib(1) = 1
fib(2) = fib(1) + fib(0) = 1 + 1 = 2
fib(3) = fib(2) + fib(1) = 2 + 1 = 3
fib(0) -> 1;
fib(1) -> 1;
fib(N) -> fib(N) + fib(N-1).