Skip to content

Instantly share code, notes, and snippets.

% brew install rbenv
Warning: rbenv-0.4.0 already installed
/Users/atsushi/prog/coursera/ex3-003/mlclass-ex3% brew install octave [master atsushi:~/prog/coursera/ex3-003/mlclass-ex3]
==> Installing dependencies for octave: gnu-sed, texinfo, fftw, readline, tbb, suite-sparse, glpk, libtool, jpeg, libpng, freetype, graphicsmagick, szip, hdf5, pcre, cmake, qhull, gmp, mpfr,
==> Installing octave dependency: gnu-sed
==> Downloading http://ftpmirror.gnu.org/sed/sed-4.2.2.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gnu-sed/4.2.2 --program-prefix=g
==> make install
==> Caveats
曲線フィッティング
オリジナル
http://jsfiddle.net/yBHac/1/
とりあえずJSをJSペインに分割
http://jsfiddle.net/SM2Kz/
@edvakf
edvakf / ClosureComparisonTest.php
Last active December 25, 2015 11:49
don't use phpunit's assertEquals to compare closures.
<?php
class ClosureCompraisonTest extends PHPUnit_Framework_TestCase
{
// passes. WTF???
public function test_assertEquals()
{
$f1 = function () { return 1; };
$f2 = function () { return 2; };
$this->assertEquals($f1, $f2);
@edvakf
edvakf / README.md
Last active December 22, 2015 08:29
PHPコードの複雑さチェック

complexity.php

使い方

php complexity.php filename

出力形式

diff --git a/htdocs/source/js/pre-login.js b/htdocs/source/js/pre-login.js
index 2835a85..d532175 100644
--- a/htdocs/source/js/pre-login.js
+++ b/htdocs/source/js/pre-login.js
@@ -183,6 +183,7 @@ var brick = {
function loop() {
var start_position = position, i = 0, width = 0, height, r = [], w = [], list, item, data, right_margin, target, current_width = 0, top;
+ var rsum = 0;
#import <Cocoa/Cocoa.h>
#include <stdio.h>
#include <time.h>
#include <dispatch/dispatch.h>
#include <curl/curl.h>
#define MAXLINE 512
CFMachPortRef eventTap;
/***
P R O C E S S I N G . J S - 1.3.0
a port of the Processing visualization language
Processing.js is licensed under the MIT License, see LICENSE.
For a list of copyright holders, please refer to AUTHORS.
http://processingjs.org
#!/usr/bin/python
from PIL import Image
from math import sqrt
from numpy.fft import rfft
from collections import Counter
def computeContinuityScore(image, x1, x2):
width, height = image.size
data = image.getdata()
# CoffeeScript version 1.1.2
# compiles
if 'foo' ==
String.fromCharCode.apply(null,
[102, 111, 111])
alert 'foo!!'
# doesn't compile
if 'foo' ==
package extensions;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.Charset;