@mizchi / Quipper
- 人間性捧げすぎて資料作るの忘れてました
// buildSrc/src/main/groovy/JavaAptPlugin.groovy | |
class JavaAPT extends DefaultTask { | |
private File _destinationDir | |
def getDestinationDir(dir) { _destinationDir } | |
void setDestinationDir(dir) { | |
_destinationDir = dir | |
outputs.dir _destinationDir | |
} |
/* vim: set tabstop=2 shiftwidth=2 softtabstop=2: */ | |
define([ | |
'backbone', | |
'backbone-forms' | |
], | |
function(Backbone) { | |
var Form = Backbone.Form, |
# INFO extracted from : http://stackoverflow.com/questions/6331065/matching-balanced-parenthesis-in-ruby-using-recursive-regular-expressions-like-pe | |
require 'wikipedia' | |
wikipage = Wikipedia.find(title) | |
# This regular expression is not valid for infoboxes with '}' (i.e: http://en.wikipedia.org/wiki/The_Royal_Anthem_of_Jordan) | |
no_infoboxes = wikipage.content.gsub(/\{\{[^\}]*\}\}/, "") | |
# This regular expression makes use of recursive regular expressions so now handles recursive {{}} structures | |
no_infoboxes = wikipage.content.gsub(%r{(?<re>\{\{(?:(?> [^\{\}]+ )|\g<re>)*\}\})}x, "") |
com.mysema.query.sql.ant.AntMetaDataExporter
を用いると、データベーススキーマから Java Beanとメタクラスを生成してくれる。今回は下記のようなリレーションをもつBeanを生成した前提の例である。// Generated on 2013-07-30 using generator-webapp 0.2.6 | |
'use strict'; | |
var LIVERELOAD_PORT = 35729; | |
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); | |
var mountFolder = function (connect, dir) { | |
return connect.static(require('path').resolve(dir)); | |
}; | |
// # Globbing | |
// for performance reasons we're only matching one level down: |
# Since CoffeeScript wraps everything in a closure by default, the module | |
# definition function pattern that Marionette normally uses is unnecessary. | |
# (And cumbersome with having to indent everything.) Instead, creating the | |
# module at the very begining makes it available to everything in the file, and | |
# the initializers and exported classes can be added at the end of the file. | |
# (This relies on things like the App and Backbone being on window, but they | |
# already have to be for CoffeeScript-based code to work.) | |
# Create the module. | |
Foo = App.module 'Foo' |
# stage の操作 | |
git add . # stage に加える | |
git add -p # stage にインタラクティブに加える | |
git add -N . # stage にファイルだけ加える | |
git rm hoge/hoge.rb # stage から消す | |
git rm -f hoge/hoge.rb # stage から無理矢理消す、先にファイルを消してしまった場合 | |
git mv hoge/hoge.rb hoge/hoge2.rb # ファイル名変える | |
# 差とか状態を確認する系 | |
git diff # HEADとunstagedの差分を確認する |
import Control.Applicative | |
-- fmap : (a -> b) -> f a -> f b | |
-- fmap は関数とファクター値を引数にとって, 関数をファンクター値の中の値に適用 | |
class Functor f where | |
fmap :: (a -> b) -> f a -> f b | |
-- <*> : f (a -> b) -> f a -> f b (f is Fanctor) | |
-- <*> は関数の入っているファンクター値と値の入っているファンクター値を引数にとって, ひとつ目のファンクターの中身の関数をふたつ目のファンクターの中身に適用 |
import org.gradle.api.plugins.jetty.internal.JettyPluginWebAppContext | |
apply plugin: "jetty" | |
def newResourceCollection(File... resources) { | |
shell = new GroovyShell(JettyPluginWebAppContext.class.classLoader) | |
shell.setProperty("resources", resources as String[]) | |
return shell.evaluate(file("resource_collection.groovy")) | |
} |