Skip to content

Instantly share code, notes, and snippets.

edvakf

Block or report user

Report or block edvakf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@edvakf
edvakf / ClosureComparisonTest.php
Last active Dec 25, 2015
don't use phpunit's assertEquals to compare closures.
View ClosureComparisonTest.php
<?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 Dec 22, 2015
PHPコードの複雑さチェック
View README.md

complexity.php

使い方

php complexity.php filename

出力形式

View gist:4626945
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;
View logger.m
#import <Cocoa/Cocoa.h>
#include <stdio.h>
#include <time.h>
#include <dispatch/dispatch.h>
#include <curl/curl.h>
#define MAXLINE 512
CFMachPortRef eventTap;
View Processing.min.js
/***
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
View unshred.py
#!/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()
View foo.coffee
# CoffeeScript version 1.1.2
# compiles
if 'foo' ==
String.fromCharCode.apply(null,
[102, 111, 111])
alert 'foo!!'
# doesn't compile
if 'foo' ==
View nlMovieFetcher.java
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;
@edvakf
edvakf / bookmarklet.js
Created Aug 24, 2011
Opera's bug, xpath "text()" returns non-text elements
View bookmarklet.js
javascript:(function(){
var x=document.evaluate('//body//text()',document,null,7,null);
for(var i=0,l=x.snapshotLength,e;e=x.snapshotItem(i++);i<l)
if(e.nodeType!==3)
console.log(e)
})()
// => [object HTMLDivElement]
//http://www.montrealgazette.com/Canadian+wireless+startup+takes+maverick+approach/5300364/story.html
View fldr_show_fc2_images.user.js
// ==UserScript==
// @name fldr_show_fc2_images.user.js
// @namespace http://d.hatena.ne.jp/os0x/
// @description Make fc2 images viewable on LDR/Fastladder
// @include http://reader.livedoor.com/reader/
// @include http://reader.livedoor.com/public/*
// @include http://fastladder.com/reader/
// ==/UserScript==
// via http://gist.github.com/48621
You can’t perform that action at this time.