Skip to content

Instantly share code, notes, and snippets.

{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"default_line_ending": "windows",
"font_size": 12.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
],

ブラックボックステスト

関数の入出力だけに着目したテスト

ホワイトボックステスト

関数の内部実装を踏まえて、すべての条件分岐、判定処理を少なくとも一回は検証するテスト

@foo9
foo9 / gist:9458096
Last active August 29, 2015 13:57
Geolocation API
function geolocation() {
var deferred = $.Deferred();
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
deferred.resolve(position.coords);
}, function (error) {
deferred.reject(error.code);
});
} else {
@foo9
foo9 / gist:9461980
Last active August 29, 2015 13:57
Get image dimensions. (use PHP)
path = ARGV[0]
if File.file?(path) and /\.(?:jpeg|jpg|gif|png|bmp)/i =~ File.extname(path)
system(%{php -r '$w = getimagesize("#{path}"); echo("width: ${w[0]}px; height: ${w[1]}px;");'})
else
puts ""
end
@foo9
foo9 / gist:9543122
Last active December 4, 2024 17:45
mac mavericks & adobe photoshop cs6 (! you need allow accessibility apps to access.)
-- アプリが起動してない場合
if not application "Adobe Photoshop CS6" is running then
-- 入力ソースをU.S.に切り替える
tell application "System Events" to tell process "SystemUIServer"
tell (menu bar item 1 of menu bar 1 where description is "text input")
click
click menu item "U.S." of menu 1
end tell
end tell
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-jade'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.initConfig
connect:
server:
options:
port: 9000
$ g++ -std=c++11 hoge.cpp -o hoge
$ ./hoge
zurb/foundation | https://github.com/zurb/foundation
Semantic-Org/Semantic-UI | https://github.com/semantic-org/semantic-ui/
yui/pure | https://github.com/yui/pure
uikit/uikit | https://github.com/uikit/uikit
sapo/Ink | https://github.com/sapo/Ink/
GumbyFramework/Gumby | https://github.com/GumbyFramework/Gumby
jonikorpi/Golden-Grid-System | https://github.com/jonikorpi/Golden-Grid-System
ThisIsDallas/Simple-Grid | https://github.com/ThisIsDallas/Simple-Grid
iKreativ/Workless | https://github.com/iKreativ/Workless
andhart/bijou | https://github.com/andhart/bijou
@foo9
foo9 / capture.js
Created August 3, 2014 08:40
phantomjs capture.js
var system = require('system');
var url = system.args[1];
var page = require('webpage').create();
page.viewportSize = { width: 1024, height: 800 };
page.open(url, function(status) {
if (status === 'success') {
setTimeout(function() {
page.evaluate(function() {
document.body.style.backgroundColor = 'white';
});
@foo9
foo9 / fetchFbLikeCount.js
Created October 10, 2014 13:25
Fetch Facebook Like Count Sample
function fetchFbLikeCount(url) {
return $.ajax({
dataType: 'json',
url: 'http://graph.facebook.com/?id=' + encodeURI(url)
}).done(function(data) {
console.log(url, data.shares);
});
}
var urls = [