SlideShare une entreprise Scribd logo
1  sur  36
http://twitter.com/#!/cactusman/status/9123744081510400
gist.github
https://gist.github.com/
https://gist.github.com/gists
Groovy
gist 310321


File.glob('**/[a-z]*.groovy')
gist 233429
import javax.sound.midi.*

def synth = MidiSystem.getSynthesizer()
synth.open()
def channel = synth.getChannels()[9]
channel.noteOn(56, 96)
Thread.sleep(100)
channel.noteOff(56)
synth.close()
gist 250489
score = [
  [A2, d4],       [A2,   d4],   [B2,   d2],
  [A2, d4],       [A2,   d4],   [B2,   d2],
  [A2, d4],       [B2,   d4],   [C2,   d4], [B2, d4],
  [A2, d4],       [B2,   d8],   [A2,   d8], [F1, d2],

    [E1,   d4],   [C1,   d4],   [E1,   d4],   [F1,   d4],
    [E1,   d4],   [E1,   d8],   [C1,   d8],   [B1,   d2],
    [A2,   d4],   [B2,   d4],   [C2,   d4],   [B2,   d4],
    [A2,   d4],   [B2,   d8],   [A2,   d8],   [F1,   d2],
    [E1,   d4],   [C1,   d4],   [E1,   d4],   [F1,   d4],
    [E1,   d4],   [E1,   d8],   [C1,   d8],   [B1,   d2],

    [A2,   d4],   [A2, d4], [B2, d2],
    [A2,   d4],   [A2, d4], [B2, d2],
    [E1,   d4],   [F1, d4], [B2, d8], [A2, d8], [F1, d4],
    [E1,   d2],   [null, d2],
]
gist 506855
import hudson.model.*
import hudson.slaves.*
node = new DumbSlave("testing", "Testing node",
   "/home/hudson", "2", Node.Mode.NORMAL,
   "test label", new JNLPLauncher(),
   new RetentionStrategy.Always(),
   new ArrayList())
hudson.model.Hudson.instance.addNode(node)
gist 702337
gist 524018
Newbie programmer


int factorial_newbie(int n) {
    if (n == 0) {
        return 1
    } else {
        return n * factorial_newbie(n - 1)
    }
}
println factorial_newbie(6)
First year programmer,
    studied Pascal

  int factorial_pascal(int n) {
      int result = 1;
      for (int i = 1; i <= n; i++) {
          result = result * i;
      }
      return result;
  }
  println factorial_pascal(6)
First year programmer,
       studied C

  int fact_c(int n) {
      int result = 1;
      for (int i = 1; i <= n; i++) {
          result *= i;
      }
      return result;
  }
  println fact_c(6)
First year programmer,
        Python

   int Factorial_python(int n) {
       int res = 1
       (2..n).each { i ->
           res *= i
       }
       return res
   }
   println Factorial_python(6)
Lazy Groovy programmer



int fact_lazy(int n) {
    return (n <= 1) ? 1 : n * fact_lazy(n - 1)
}
println fact_lazy(6)
Lazier Groovy programmer



def factLazier = { (it <= 1) ? 1 : it * call(it - 1) }
println factLazier(6)
Groovy expert programmer


def factExpert = { n ->
 n ? (1..n).inject(1, { a, b -> a * b }): 1 }
println factExpert(6)
Enterprise programmer
class InternalBase {
    private int base

    public InternalBase(Integer base) {
        this.base = base.intValue()
    }

    int getBase() {
        return new Integer(base)
    }
}

class StandardMathematicsSystem {
    private static StandardMathematicsSystem INSTANCE = null
    private Integer base

    private StandardMathematicsSystem(InternalBase base) throws RuntimeException {
        if (base.getBase().compareTo(new Integer(2)) != 0) {
            throw RuntimeException("Non base 2 bases are not supported.")
        }
        this.base = base.getBase()
    }

    int calculateFactorial(Integer target) {
        Integer result = new Integer(1)
        for (Integer i = new Integer(2); i.compareTo(target) <= 0; i = new Integer(i.intValue() + 1)) {
            result = result * i
        }
        return result
    }

    static private StandardMathematicsSystem createInstance(InternalBase base) {
        return new StandardMathematicsSystem(base)
    }

    static StandardMathematicsSystem getInstance(InternalBase base) {
        if (INSTANCE == null) {
            INSTANCE = createInstance(base)
        }
        return INSTANCE
    }
}
println StandardMathematicsSystem.getInstance(new InternalBase(new Integer(2))).calculateFactorial(new Integer(6))
Gist
Gist G
Groovy G
gist 326626

groovywebconsole.user.js
Gist                   Groovy
               Greasemonkey

for Firefox (not for Chrome)
Groovy   Gist
とある断片の超動的言語

Contenu connexe

Tendances

Real world scala
Real world scalaReal world scala
Real world scala
lunfu zhong
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3
ecomputernotes
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
Abhishek Jena
 

Tendances (19)

Nested micro
Nested microNested micro
Nested micro
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Real world scala
Real world scalaReal world scala
Real world scala
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
C++ assignment
C++ assignmentC++ assignment
C++ assignment
 
Java JIT Optimization Research
Java JIT Optimization Research Java JIT Optimization Research
Java JIT Optimization Research
 
Queue oop
Queue   oopQueue   oop
Queue oop
 
Data structures lab manual
Data structures lab manualData structures lab manual
Data structures lab manual
 
Grover's Algorithm
Grover's AlgorithmGrover's Algorithm
Grover's Algorithm
 
C programs
C programsC programs
C programs
 
DSU C&C++ Practical File Diploma
DSU C&C++ Practical File DiplomaDSU C&C++ Practical File Diploma
DSU C&C++ Practical File Diploma
 
C++ file
C++ fileC++ file
C++ file
 
Heap sort &amp; bubble sort
Heap sort &amp; bubble sortHeap sort &amp; bubble sort
Heap sort &amp; bubble sort
 
Basic Programs of C++
Basic Programs of C++Basic Programs of C++
Basic Programs of C++
 
COSCUP: Introduction to Julia
COSCUP: Introduction to JuliaCOSCUP: Introduction to Julia
COSCUP: Introduction to Julia
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3
 
Presentation1 computer shaan
Presentation1 computer shaanPresentation1 computer shaan
Presentation1 computer shaan
 
81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs81818088 isc-class-xii-computer-science-project-java-programs
81818088 isc-class-xii-computer-science-project-java-programs
 
How to practice functional programming in react
How to practice functional programming in reactHow to practice functional programming in react
How to practice functional programming in react
 

En vedette (10)

日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ
 
Jenkins plugin memo
Jenkins plugin memoJenkins plugin memo
Jenkins plugin memo
 
Gaelyk
GaelykGaelyk
Gaelyk
 
Devsumi Openjam
Devsumi OpenjamDevsumi Openjam
Devsumi Openjam
 
Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜Griffon不定期便〜G*ワークショップ編〜
Griffon不定期便〜G*ワークショップ編〜
 
GroovyConsole2
GroovyConsole2GroovyConsole2
GroovyConsole2
 
Mote Hudson
Mote HudsonMote Hudson
Mote Hudson
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
JUC2012
JUC2012JUC2012
JUC2012
 
Jenkins user conference 東京
Jenkins user conference 東京Jenkins user conference 東京
Jenkins user conference 東京
 

Similaire à とある断片の超動的言語

Python-GTK
Python-GTKPython-GTK
Python-GTK
Yuren Ju
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
Yuren Ju
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
archanaemporium
 

Similaire à とある断片の超動的言語 (20)

Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Python GTK (Hacking Camp)
Python GTK (Hacking Camp)Python GTK (Hacking Camp)
Python GTK (Hacking Camp)
 
Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)Kotlin Perfomance on Android / Александр Смирнов (Splyt)
Kotlin Perfomance on Android / Александр Смирнов (Splyt)
 
Java oops features
Java oops featuresJava oops features
Java oops features
 
Let’s talk about microbenchmarking
Let’s talk about microbenchmarkingLet’s talk about microbenchmarking
Let’s talk about microbenchmarking
 
Guice2.0
Guice2.0Guice2.0
Guice2.0
 
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
Grails 1.2 探検隊 -新たな聖杯をもとめて・・・-
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Java practical
Java practicalJava practical
Java practical
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Awt
AwtAwt
Awt
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
 
06slide.ppt
06slide.ppt06slide.ppt
06slide.ppt
 
Effective Java with Groovy
Effective Java with GroovyEffective Java with Groovy
Effective Java with Groovy
 
Programs of java
Programs of javaPrograms of java
Programs of java
 
Save Write a program to implement Binary search using recursive algo.pdf
Save Write a program to implement Binary search using recursive algo.pdfSave Write a program to implement Binary search using recursive algo.pdf
Save Write a program to implement Binary search using recursive algo.pdf
 
Golang dot-testing-lite
Golang dot-testing-liteGolang dot-testing-lite
Golang dot-testing-lite
 
This code currently works... Run it and get a screen shot of its .docx
 This code currently works... Run it and get a screen shot of its .docx This code currently works... Run it and get a screen shot of its .docx
This code currently works... Run it and get a screen shot of its .docx
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 

Plus de Kiyotaka Oku

Plus de Kiyotaka Oku (15)

Osaka Venture Meetup #3
Osaka Venture Meetup #3Osaka Venture Meetup #3
Osaka Venture Meetup #3
 
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
 
BaseScriptについて
BaseScriptについてBaseScriptについて
BaseScriptについて
 
javafx-mini4wd
javafx-mini4wdjavafx-mini4wd
javafx-mini4wd
 
ミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考えるミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考える
 
Spockの基礎
Spockの基礎Spockの基礎
Spockの基礎
 
GDK48総選挙の裏側
GDK48総選挙の裏側GDK48総選挙の裏側
GDK48総選挙の裏側
 
Jenkins入門
Jenkins入門Jenkins入門
Jenkins入門
 
Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介
 
GroovyConsole
GroovyConsoleGroovyConsole
GroovyConsole
 
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方Jenkinsプラグインの作り方
Jenkinsプラグインの作り方
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
Groovy and-hudson2
Groovy and-hudson2Groovy and-hudson2
Groovy and-hudson2
 
JDO
JDOJDO
JDO
 
Grails on GAE/J
Grails on GAE/JGrails on GAE/J
Grails on GAE/J
 

Dernier

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

とある断片の超動的言語

  • 1.
  • 2.
  • 3.
  • 8.
  • 11. import javax.sound.midi.* def synth = MidiSystem.getSynthesizer() synth.open() def channel = synth.getChannels()[9] channel.noteOn(56, 96) Thread.sleep(100) channel.noteOff(56) synth.close()
  • 13. score = [ [A2, d4], [A2, d4], [B2, d2], [A2, d4], [A2, d4], [B2, d2], [A2, d4], [B2, d4], [C2, d4], [B2, d4], [A2, d4], [B2, d8], [A2, d8], [F1, d2], [E1, d4], [C1, d4], [E1, d4], [F1, d4], [E1, d4], [E1, d8], [C1, d8], [B1, d2], [A2, d4], [B2, d4], [C2, d4], [B2, d4], [A2, d4], [B2, d8], [A2, d8], [F1, d2], [E1, d4], [C1, d4], [E1, d4], [F1, d4], [E1, d4], [E1, d8], [C1, d8], [B1, d2], [A2, d4], [A2, d4], [B2, d2], [A2, d4], [A2, d4], [B2, d2], [E1, d4], [F1, d4], [B2, d8], [A2, d8], [F1, d4], [E1, d2], [null, d2], ]
  • 15. import hudson.model.* import hudson.slaves.* node = new DumbSlave("testing", "Testing node", "/home/hudson", "2", Node.Mode.NORMAL, "test label", new JNLPLauncher(), new RetentionStrategy.Always(), new ArrayList()) hudson.model.Hudson.instance.addNode(node)
  • 18. Newbie programmer int factorial_newbie(int n) { if (n == 0) { return 1 } else { return n * factorial_newbie(n - 1) } } println factorial_newbie(6)
  • 19. First year programmer, studied Pascal int factorial_pascal(int n) { int result = 1; for (int i = 1; i <= n; i++) { result = result * i; } return result; } println factorial_pascal(6)
  • 20. First year programmer, studied C int fact_c(int n) { int result = 1; for (int i = 1; i <= n; i++) { result *= i; } return result; } println fact_c(6)
  • 21. First year programmer, Python int Factorial_python(int n) { int res = 1 (2..n).each { i -> res *= i } return res } println Factorial_python(6)
  • 22. Lazy Groovy programmer int fact_lazy(int n) { return (n <= 1) ? 1 : n * fact_lazy(n - 1) } println fact_lazy(6)
  • 23. Lazier Groovy programmer def factLazier = { (it <= 1) ? 1 : it * call(it - 1) } println factLazier(6)
  • 24. Groovy expert programmer def factExpert = { n -> n ? (1..n).inject(1, { a, b -> a * b }): 1 } println factExpert(6)
  • 25. Enterprise programmer class InternalBase { private int base public InternalBase(Integer base) { this.base = base.intValue() } int getBase() { return new Integer(base) } } class StandardMathematicsSystem { private static StandardMathematicsSystem INSTANCE = null private Integer base private StandardMathematicsSystem(InternalBase base) throws RuntimeException { if (base.getBase().compareTo(new Integer(2)) != 0) { throw RuntimeException("Non base 2 bases are not supported.") } this.base = base.getBase() } int calculateFactorial(Integer target) { Integer result = new Integer(1) for (Integer i = new Integer(2); i.compareTo(target) <= 0; i = new Integer(i.intValue() + 1)) { result = result * i } return result } static private StandardMathematicsSystem createInstance(InternalBase base) { return new StandardMathematicsSystem(base) } static StandardMathematicsSystem getInstance(InternalBase base) { if (INSTANCE == null) { INSTANCE = createInstance(base) } return INSTANCE } } println StandardMathematicsSystem.getInstance(new InternalBase(new Integer(2))).calculateFactorial(new Integer(6))
  • 26.
  • 27. Gist
  • 28.
  • 29.
  • 30.
  • 31.
  • 33.
  • 34. gist 326626 groovywebconsole.user.js Gist Groovy Greasemonkey for Firefox (not for Chrome)
  • 35. Groovy Gist

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n