Skip to content

Instantly share code, notes, and snippets.

View sshirokov's full-sized avatar
💭
I am a 🐈

Slava Shirokov sshirokov

💭
I am a 🐈
View GitHub Profile
[INFO] (csgtool.c:18) Loaded file: ./cube.stl 12 facets
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:76) bsp_build(12): 2 COPLANAR, 0 front, 10 back
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:86) Building back of 0x7fb700c03920->0x0
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:76) bsp_build(10): 2 COPLANAR, 0 front, 8 back
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:86) Building back of 0x7fb700c04c10->0x0
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:76) bsp_build(8): 2 COPLANAR, 0 front, 6 back
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:86) Building back of 0x7fb700c04e90->0x0
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:76) bsp_build(6): 2 COPLANAR, 0 front, 4 back
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:86) Building back of 0x7fb700c050f0->0x0
[INFO] (/Users/yshirokov/src/social/csgtool/src/bsp.c:76) bsp_build(4): 2 COPLANAR, 0 front, 2 back
flip: chainable () =>
@normal.multiplyScalar -1
@w *= -1
@vertices.reverse()
@sshirokov
sshirokov / emacs-trunk-erc-fix.el
Last active December 14, 2015 04:08
How I fixed the `unknown timer` error in the latest erc + znc.el
(defadvice erc-server-send-ping (around dont-choke-on-bad-timer first nil activate)
(ignore-errors
ad-do-it))
New tests for everyon!
@sshirokov
sshirokov / gist:4322223
Created December 17, 2012 21:02
I am a test
Wutwut?
var buff = new Buffer("aahelloaa");
for(var i = 0; i < 10000000; i++) {
var str = buff.slice(2, 7 + Math.round(Math.random())).toString();
}
angular.module('gitstats').controller "NavCtrl", ['$scope', '$route',
class NavCtrl
constructor: (@scope, @route) ->
route_to_nav = (path, route) =>
return if route.redirectTo?
return unless route.name?
current_route_name = () => @route.current?.$route?.name
path: path
name: route.name
classes: ->
compute_rate: ->
['messages', 'bytes'].forEach (total_type) =>
{
last: @counts[total_type].last,
rate: @counts[total_type].rate
} =
{
last: @counts[total_type].total,
rate: @counts[total_type].total - @counts[total_type].last
}
@sshirokov
sshirokov / dumbasses-string-streams.lisp
Created May 16, 2012 04:05
We're so dumb, here's a string stream
(defun 8k-with-stream ()
(let ((s (make-string-output-stream)))
(dotimes (i (* 1024 8))
(write-char (rand-char) s))
(prog1 (get-output-stream-string s)
(close s))))
@sshirokov
sshirokov / pushreverse-vs-curry.lisp
Created May 16, 2012 03:49
Comparison of currying vs pushing and reversing a list
(ql:quickload :alexandria)
(use-package :alexandria)
(defmacro rand-char ()
'(code-char (+ (random (- (char-code #\z) (char-code #\a))) (char-code #\a))))
(defun 8k-with-concatenate ()
(let ((s (string "")))
(dotimes (i (* 1024 8))
(setf s (concatenate 'string s (list (rand-char)))))