Skip to content

Instantly share code, notes, and snippets.

View suzukimilanpaak's full-sized avatar

Tatsuya Suzuki suzukimilanpaak

  • Manchester, UK
  • 06:20 (UTC +01:00)
View GitHub Profile
@suzukimilanpaak
suzukimilanpaak / cell.js
Last active November 15, 2015 03:19
Animation of a cell
var type = /(canvas|webgl)/.test(url.type) ? url.type : 'svg';
var two = new Two({
type: Two.Types[type],
fullscreen: true
}).appendTo(document.body);
var mass = 100;
var radius = two.height / 5;
var strength = 0.0625;
var drag = 0.0;
@suzukimilanpaak
suzukimilanpaak / permission denied when backing-up.log
Last active August 29, 2015 14:06
Warning on the top page of Sbulimerecords.net
$ cp -r web web.bak
cp: cannot open `web1/wp-content/img.php' for reading: Permission denied
cp: cannot open `web1/wp-content/plugins/mos.php' for reading: Permission denied
cp: cannot open `web1/wp-content/plugins/csv.php' for reading: Permission denied
cp: cannot open `web1/wp-content/plugins/wp-multibyte-patch/languages/wp-multibyte-patch-ja.php' for reading: Permission denied
cp: cannot open `web1/wp-content/plugins/wp-multibyte-patch/js/jquery.Jcrop.php' for reading: Permission denied
cp: cannot open `web1/wp-content/ws1.php' for reading: Permission denied
cp: cannot open `web1/wp-content/modul.php' for reading: Permission denied
cp: cannot open `web1/wp-content/themes/source/wp-rss.php' for reading: Permission denied
cp: cannot access `web1/wp-content/themes/source/img/cache': Permission denied
function RubberBallShape(radius, world) {
b2CircleShape.call(this, radius);
this.RADIUS = radius;
this.DIFF_THRESHOLD_TO_ROUND = this.RADIUS * 0.02;
this.IMPULSE_THRESHOLD_TO_STOP_UPDATING = 20;
}
RubberBallShape.prototype = Object.create(b2CircleShape.prototype);
@suzukimilanpaak
suzukimilanpaak / RubberBallShape.js
Last active August 29, 2015 14:02
diff RubberBallShape
function RubberBallShape(radius, world) {
b2CircleShape.call(this, radius);
this.RADIUS = radius;
this.DIFF_THRESHOLD_TO_ROUND = this.RADIUS * 0.02;
this.IMPULSE_THRESHOLD_TO_STOP_UPDATING = 20;
}
RubberBallShape.prototype = Object.create(b2CircleShape.prototype);
@suzukimilanpaak
suzukimilanpaak / blogger.html
Last active August 29, 2015 13:56
Javascript for Blog
<!--
* highlight.js
-->
<link rel="stylesheet" href="https://googledrive.com/host/0B-jdnZOJbr7XUkgybU1zYUs0dG8/tomorrow.css" />
<script src="http://yandex.st/highlightjs/8.0/highlight.min.js"></script>
<style type='text/css'>
/*
pre {
@suzukimilanpaak
suzukimilanpaak / 1.mutual_friends_2014_01_05.csv
Last active January 2, 2016 06:39
Social graph with Processing Language
Tatsuya Suzuki Emi Ito Bruno Barroso Mattew Day Maxim Dokhlov Mehmet Bagbekleyen Alex Yixnitsky Stuart Gardner Derrick May
Tatsuya Suzuki 0 50 19 10 9 11 15 2 0
Emi Ito 0 0 2 3 3 2 1 2 1
Bruno Barroso 0 0 0 4 3 17 1 2 1
Mattew Day 0 0 0 0 4 5 1 2 1
Maxim Dokhlov 0 0 0 0 0 4 1 2 1
Mehmet Bagbekleyen 0 0 0 0 0 0 1 2 1
Alex Yixnitsky 0 0 0 0 0 0 0 1 1
Stuart Gardner 0 0 0 0 0 0 0 0 1
Derrick May 0 0 0 0 0 0 0 0 0
@suzukimilanpaak
suzukimilanpaak / mistake.pde
Created January 4, 2014 17:14
mistake to draw strange ghoast
import java.util.*;
// Size of display
int DISPLAY_WIDTH = 500;
int DISPLAY_HEIGHT = 500;
// Colours
int BLACK = 0;
int WHITE = 255;
int CENTER_X = 0;
@suzukimilanpaak
suzukimilanpaak / drawing_dosts_with_fibonacci.pde
Created January 4, 2014 04:54
Drawing dots with Fibonacci
import java.util.*;
Fibonacci fibonacci;
float unitAngle;
float unitFibonacciAngle;
int NUM_POINTS = 90;
float NUM_DISTANCE_FROM_APEX = 1;
class Fibonacci {
@suzukimilanpaak
suzukimilanpaak / draw_equilateral_polygon.pde
Last active January 2, 2016 01:59
Draw a Equilateral Polygon according to the number of vertexes in Processing language 2.1
// Size of display
int DISPLAY_WIDTH = 500;
int DISPLAY_HEIGHT = 500;
// Colours
int BLACK = 0;
int WHITE = 255;
int CENTER_X = 0;
int CENTER_Y = 0;
@suzukimilanpaak
suzukimilanpaak / Website.rb
Created January 1, 2014 04:12
Counter cache for HABTM
class Website < ActiveRecord::Base
has_and_belongs_to_many :categories, after_add: :increment_categories_counter_cache, after_remove: :decrement_categories_counter_cache
private
def increment_categories_counter_cache(category)
Category.increment_counter(:websites_count, category.id )
end
def decrement_categories_counter_cache(category)