i " вставить текст до курсора
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reduced | |
@isReduced = (obj) -> obj instanceof Reduced | |
constructor: (@wraped) -> | |
unwrap: -> @wraped | |
reduce = (collection, fn, seed) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns particles.core) | |
(def display (.getElementById js/document "display")) | |
(def context (.getContext display "2d")) | |
(def damping 0.999) | |
(def max-particles 250) | |
(def line-width 2) | |
(def app-state (atom {:width (.-innerWidth js/window) | |
:height (.-innerHeight js/window)})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def grid (insert [[nil nil nil nil] | |
[nil nil nil nil] | |
[nil nil nil nil] | |
[nil nil nil nil]])) | |
;; Grid functions. | |
(defn move | |
"Moves all field to the choosen direction, merges fields and inserts field value for random free location. Returns nil if game is over. Returns same grid if move doesn't change the grid." | |
[grid direction] |
-
Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.
-
Reset PS3 controller by inserting paperclip into pinhole near L2 button.
-
Connect PS3 controller to Mac with USB cable.
-
Enable Bluetooth.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
SETTINGS=$2 | |
DB_USER="dbuser" | |
DB_NAME="dbname" | |
DB_PASS="dbpass" | |
DB_HOST=localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$page_width: 850px; | |
@function grid_width($width, $margin, $columns) { | |
@return ($width - ($margin * ($columns - 1))) / $columns; | |
} | |
@mixin grid-column($columns, $prefix, $sufix, $gutter, $border_right, $border_left, $cw, $cm) { | |
$width: (($cw + $cm) * $columns) - $cm; | |
$prefix_width: ($cw + $cm) * $prefix; | |
$sufix_width: ($cw + $cm) * $sufix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oneTimePer = (ms, func) -> | |
ms or (ms = 1000) | |
-> | |
self = arguments.callee | |
self._lastTimeCalled = new Date unless self.hasOwnProperty("_lastTimeCalled") | |
if new Date - self._lastTimeCalled > ms | |
self._lastTimeCalled = new Date | |
func.apply this, arguments | |
myFunc = oneTimePer 2000, (x, y) -> x + y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shiftDate = function(date, what, count) { | |
var proc1 = 'get' + what, | |
proc2 = 'set' + what; | |
var value = Date.prototype[proc1].call(date); | |
Date.prototype[proc2].call(date, value + count); | |
return date; | |
} | |
console.log(shiftDate(new Date, 'Date', -21)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* simple */ | |
var extends = function(child, parent) { | |
var F = function() { } | |
F.prototype = parent.prototype | |
child.prototype = new F() | |
child.prototype.constructor = child | |
child.superclass = parent.prototype | |
} | |
/* from CoffeeScript */ |