Skip to content

Instantly share code, notes, and snippets.

@punund
punund / main.js
Created March 28, 2023 19:19
Infection's main
import * as ē from 'three'
import { evolve, multiply, pipe, times } from 'ramda'
// import { OrbitControls } from '../../mod/OrbitControls.js'
import { rnd, RN } from '../../mod/rnd.js'
import { createNoise2D } from 'simplex-noise'
import { mergeCurves, curves } from '../../data/curves.js'
import * as xyz from '../../fun/xyz.js'

Keybase proof

I hereby claim:

  • I am punund on github.
  • I am punund (https://keybase.io/punund) on keybase.
  • I have a public key ASCGPt86DsNnvnpXxUx57AIJzjBJLBBVFSjE8NDX3RHbawo

To claim this, I am signing this object:

@punund
punund / gist:1034276
Created June 19, 2011 13:31
Proper exception handling in Rails 3
# coding: utf-8
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from Exception, :with => :handle_exceptions
private
def handle_exceptions(e)
case e
when CanCan::AccessDenied
@punund
punund / data.json
Last active January 9, 2016 11:19
owidget: предлагаемый формат
{
"count": 10,
"locale": "en_UK",
"product": [
{
"name": "KD55X8509C Smart 3D Ultra HD 4k 55\" LED TV",
"maker": "Sony",
"brand": "Bravia",
"price": {
"amount": 102.95,
@punund
punund / 0_reuse_code.js
Created January 21, 2014 10:59
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@punund
punund / gist:7965186
Created December 14, 2013 21:35
два файла конфигурации nginx
ike@osaka:~$ cat /etc/nginx/sites-available/node-configly
server {
listen 80;
server_name www.config.ly;
location / {
proxy_pass http://unix:/var/run/proxy.sock/node-configly.80:$uri$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
# Delete branches not tracked by remote
git remote prune origin
# Prettier log
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@punund
punund / hi.js
Created December 24, 2015 12:30
served by @coffee
(function (){ var slice = [].slice;var hasProp = {}.hasOwnProperty;var bind = function(fn, me){return function(){ return fn.apply(me, arguments); };};var extend = function(child, parent) {for (var key in parent) {if (hasProp.call(parent, key)) child[key] = parent[key];}function ctor() { this.constructor = child; }ctor.prototype = parent.prototype;child.prototype = new ctor();child.__super__ = parent.prototype;return child;};var indexOf = [].indexOf || function(item) {for (var i = 0, l = this.length; i < l; i++) {if (i in this && this[i] === item) return i;} return -1; };var modulo = function(a, b) { return (+a % (b = +b) + b) % b; }; return function () {
return alert('hi');
};})();
var bases = require('bases');
var crypto = require('crypto');
// Returns a base-62 (alphanumeric only) string of the given length:
function randomStr(length) {
// We generate a random number in a space at least as big as 62^length,
// and if it's too big, we just retry. This is still statistically O(1)
// since repeated probabilities less than one converge to zero. Hat-tip to
// a Google interview for teaching me this technique! ;)
indexB: ->
x = fs.readFileSync xmlInput
parser.parseString x, (error_xml, res_xml) ->
for product in res_xml?.products?.product[0..0]
r = request
uri: S.Found.uri + '/stock/one'
method: 'POST'
json: product
r.pipe process.stdout