Skip to content

Instantly share code, notes, and snippets.

View ChillyBwoy's full-sized avatar
🕶️
(ノ ˘_˘)ノ ζ|||ζ ζ|||ζ ζ|||ζ

Eugene Cheltsov ChillyBwoy

🕶️
(ノ ˘_˘)ノ ζ|||ζ ζ|||ζ ζ|||ζ
  • 東京都
View GitHub Profile
@ChillyBwoy
ChillyBwoy / vim-cheatsheet_ru.md
Last active March 29, 2017 14:43 — forked from A/vim-cheatsheet_ru.md
Vim cheatsheet

Конфиги

Навигация

Различные способы перехода в режим вставки

i " вставить текст до курсора
@ChillyBwoy
ChillyBwoy / transducers.coffee
Last active March 30, 2017 14:55
Transducers CoffeeScript
class Reduced
@isReduced = (obj) -> obj instanceof Reduced
constructor: (@wraped) ->
unwrap: -> @wraped
reduce = (collection, fn, seed) ->
@ChillyBwoy
ChillyBwoy / core.cljs
Created May 22, 2014 23:54
Simple particles in ClojureScript
(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)}))
@ChillyBwoy
ChillyBwoy / 2048.clj
Last active March 29, 2017 14:43 — forked from luisgerhorst/2048.clj
Clojure implementation of 2048
(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]
@ChillyBwoy
ChillyBwoy / gist:6172771
Last active March 29, 2017 14:42 — forked from statico/gist:3172711
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. 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.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.

@ChillyBwoy
ChillyBwoy / server.sh
Last active October 13, 2015 14:18
django server script
#!/usr/bin/env bash
set -e
SETTINGS=$2
DB_USER="dbuser"
DB_NAME="dbname"
DB_PASS="dbpass"
DB_HOST=localhost
@ChillyBwoy
ChillyBwoy / grid.scss
Last active October 11, 2015 01:38
960gs in SCSS mixin
$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;
@ChillyBwoy
ChillyBwoy / app.coffee
Created June 10, 2012 12:19
call function one per second
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
@ChillyBwoy
ChillyBwoy / main.js
Created September 4, 2011 22:17
JavaScript Date shift
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));
@ChillyBwoy
ChillyBwoy / extends.js
Created June 5, 2011 22:59
JavaScript inherit
/* 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 */