Skip to content

Instantly share code, notes, and snippets.

Avatar
:atom:
writing code everyday

Junya Ogura juno

:atom:
writing code everyday
View GitHub Profile
@juno
juno / jasmine-example.js
Created Nov 30, 2010
Jasmineによるテストコードのサンプル
View jasmine-example.js
describe("Jasmine", function() {
it("makes testing JavaScript awesome!", function() {
expect(yourCode).toBeLotsBetter();
});
});
@juno
juno / jasmine-example2.js
Created Dec 1, 2010
Arrayクラスのテスト
View jasmine-example2.js
describe('Array クラスは', function() {
it('length プロパティで配列長を取得する事ができる', function() {
var arr = [1, 2, 3];
expect(arr.length).toEqual(3);
});
});
@juno
juno / SpecRunner.html
Created Dec 1, 2010
Arrayクラスのテストを実行するためのSpecRunner.html
View SpecRunner.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Jasmine Test Runner</title>
<link rel="stylesheet" type="text/css" href="lib/jasmine-1.0.1/jasmine.css">
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script>
<!-- include spec files here... -->
@juno
juno / jasmine.yml
Created Dec 1, 2010
jasmine initで生成されるjasmine.yml
View jasmine.yml
# src_files
#
# Return an array of filepaths relative to src_dir to include before jasmine specs.
# Default: []
#
# EXAMPLE:
#
# src_files:
# - lib/source1.js
# - lib/source2.js
@juno
juno / heroku-api-client-example.rb
Created Dec 2, 2010
Example implement for heroku info APP_NAME. Requires rest-client and nokogiri.
View heroku-api-client-example.rb
require 'rest_client'
require 'nokogiri'
resource = RestClient::Resource.new('https://api.heroku.com', 'USERNAME', 'PASSWORD')
args = [:get, nil, {
'X-Heroku-API-Version' => '2',
'User-Agent' => 'my heroku client/1.0',
'X-Ruby-Version' => RUBY_VERSION,
'X-Ruby-Platform' => RUBY_PLATFORM
}].compact
@juno
juno / jasmine-example-3.js
Created Dec 7, 2010
beforeEachを使った例。
View jasmine-example-3.js
/**
* Array クラスのテスト
*/
describe('Array クラスは', function() {
var arr = null;
beforeEach(function() {
arr = [1, 2, 3];
});
@juno
juno / jasmine-example-4.js
Created Dec 7, 2010
beforeEachを使った例。
View jasmine-example-4.js
/**
* Array クラスのテスト
*/
describe("Array クラスは", function() {
var arr = null;
beforeEach(function() {
arr = [1, 2, 3];
});
@juno
juno / DocumentSpec-01.js
Created Dec 24, 2010
Jasmineによるdocument.getElementByIdのテスト
View DocumentSpec-01.js
/**
* Document クラスのテスト
*/
describe('Document オブジェクトは', function() {
it('getElementById メソッドで特定の ID を持つ DOM オブジェクトを取得する事ができる', function() {
var elementId = 'test-node';
expect(document.getElementById(elementId)).not.toBeNull();
});
});
@juno
juno / rcov.rake
Created Jan 7, 2011 — forked from alexdreher/rcov.rake
Rails coverage rake task for rcov, rspec and steak
View rcov.rake
# Forked to get it working with Rails 3 and RSpec 2
#
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
#
# Use rcov:rspec or rcov:steak
# to get non-aggregated coverage reports for rspec or steak separately
@juno
juno / localtime.rb
Created Jan 7, 2011
convert heroku logs to localtime
View localtime.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'time'
pattern = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}-\d{2}:\d{2}) (.+)$/
ARGF.each { |line| puts "#{Time.parse($1)} #{$2}" if line =~ pattern }
You can’t perform that action at this time.