├── .gitattributes ├── samples ├── Text │ ├── foo.txt │ ├── mac.txt │ ├── readme.txt │ └── messages.fr ├── STON │ ├── Array.ston │ ├── Dictionary.ston │ ├── Rectangle.ston │ ├── TestDomainObject.ston │ └── properties.ston ├── Ruby │ ├── foo.rb │ ├── grit.rb │ ├── ruby.script! │ ├── filenames │ │ ├── Rakefile │ │ ├── Capfile │ │ ├── Appraisals │ │ └── .pryrc │ ├── macruby.script! │ ├── ruby2.script! │ ├── script.rake │ └── rabl.rabl ├── Tea │ └── foo.tea ├── Emacs Lisp │ └── dude.el ├── JavaScript │ ├── dude.js │ ├── js.script! │ ├── outro.js.frag │ ├── hello.js │ ├── intro.js.frag │ ├── helloHanaMath.xsjslib │ ├── js2.script! │ ├── jsbuild.jsb │ └── helloHanaEndpoint.xsjs ├── Markdown │ └── tender.md ├── Ant Build System │ └── filenames │ │ └── build.xml ├── Nit │ ├── hello_world.nit │ └── print_arguments.nit ├── Scilab │ ├── scilab_script.sce │ ├── scilab_test.tst │ └── scilab_function.sci ├── Shell │ ├── script.sh │ ├── sh.script! │ ├── bash.script! │ ├── filenames │ │ ├── .bash_logout │ │ ├── bash_logout │ │ ├── .login │ │ ├── .zlogin │ │ ├── .zshrc │ │ ├── login │ │ ├── profile │ │ ├── zlogin │ │ ├── zshrc │ │ ├── .profile │ │ ├── .zshenv │ │ ├── zshenv │ │ ├── .zlogout │ │ ├── zlogout │ │ ├── .cshrc │ │ └── cshrc │ ├── script.bash │ ├── script.zsh │ ├── zsh.script! │ ├── invalid-shebang.sh │ ├── string-chopping.script! │ ├── php.fcgi │ ├── build.command │ ├── 99-bottles-of-beer.script! │ └── rbenv-sh-shell.sh ├── Stata │ ├── limits.matah │ ├── common.doh │ ├── include.ihlp │ ├── hello.ado │ ├── tanh.mata │ └── regress_example.do ├── AutoHotkey │ └── hello.ahk ├── Cirru │ ├── require.cirru │ ├── number.cirru │ ├── string.cirru │ ├── block.cirru │ ├── bool.cirru │ ├── array.cirru │ ├── map.cirru │ ├── scope.cirru │ └── stdio.cirru ├── Haml │ └── hello.haml ├── Jade │ └── hello.jade ├── Scaml │ └── hello.scaml ├── Swift │ ├── section-3.swift │ ├── section-45.swift │ ├── section-47.swift │ ├── section-17.swift │ ├── section-5.swift │ ├── section-15.swift │ ├── section-9.swift │ ├── section-7.swift │ ├── section-51.swift │ ├── section-33.swift │ ├── section-43.swift │ ├── section-67.swift │ ├── section-75.swift │ ├── section-63.swift │ ├── section-31.swift │ ├── section-27.swift │ ├── section-81.swift │ ├── section-11.swift │ ├── section-49.swift │ ├── section-37.swift │ ├── section-35.swift │ ├── section-39.swift │ ├── section-29.swift │ ├── section-83.swift │ ├── section-85.swift │ ├── section-21.swift │ ├── section-61.swift │ ├── section-79.swift │ ├── section-19.swift │ ├── section-13.swift │ ├── section-53.swift │ ├── section-71.swift │ ├── section-25.swift │ ├── section-41.swift │ ├── section-87.swift │ ├── section-23.swift │ ├── section-73.swift │ ├── section-69.swift │ ├── section-55.swift │ ├── section-65.swift │ ├── section-77.swift │ ├── section-57.swift │ └── section-59.swift ├── OpenEdge ABL │ └── openedge.p ├── TypeScript │ ├── hello.ts │ └── classes.ts ├── CoffeeScript │ ├── hello.coffee │ ├── classes.coffee │ └── intro.coffee ├── Gosu │ ├── hello.vark │ ├── Hello.gst │ └── Hello.gsx ├── Nu │ └── nu.script! ├── Perl │ ├── script.pl │ ├── perl.script! │ ├── test-perl.pl │ ├── test-perl2.pl │ ├── use5.pl │ ├── strict.t │ ├── perl-test.t │ ├── oo1.pl │ ├── oo2.pl │ ├── oo3.pl │ └── fib.pl ├── PHP │ ├── prefix.fcgi │ ├── php-script.script! │ ├── php.script! │ ├── exception.zep.php │ ├── filenames │ │ └── .php │ └── php2.script! ├── VimL │ └── filenames │ │ ├── .gvimrc │ │ ├── .vimrc │ │ └── _vimrc ├── Coq │ └── Sorting.v ├── Groovy │ ├── groovy.script! │ ├── script.gvy │ ├── template.grt │ ├── template.gtpl │ └── build.script! ├── Ioke │ └── hello.ik ├── Makefile │ ├── makefile.script! │ └── filenames │ │ └── Makefile ├── Nimrod │ └── foo.nim ├── Papyrus │ └── vMFX_FXPlugin.psc ├── Python │ ├── python.script! │ └── MoveEye.pyde ├── QMake │ ├── qmake.script! │ ├── functions.pri │ ├── simple.pro │ └── complex.pro ├── ShellSession │ ├── dollar.sh-session │ └── simple.sh-session ├── OpenSCAD │ ├── simple.scad │ └── not_simple.scad ├── SaltStack │ └── top.sls ├── Mathematica │ ├── Init.m │ ├── Problem12.m │ └── PacletInfo.m ├── Objective-C │ ├── Foo.m │ ├── Foo.h │ ├── hello.m │ ├── FooAppDelegate.h │ ├── FooAppDelegate.m │ ├── MainMenuViewController.h │ └── PlaygroundViewController.h ├── C │ ├── hello.h │ ├── hello.c │ ├── exception.zep.h │ ├── syscalldefs.h │ ├── Nightmare.h │ ├── exception.zep.c │ ├── blob.c │ └── blob.h ├── Chapel │ └── hello.chpl ├── INI │ └── filenames │ │ ├── .gitconfig │ │ └── .editorconfig ├── M │ ├── helloworld.m │ ├── mileage.m │ ├── fibonacci.m │ ├── primes.m │ ├── functions.m │ ├── forloop.m │ ├── nesting.m │ ├── indirectfunctions.m │ ├── arrays.m │ └── ifelse.m ├── R │ ├── hello-r.R │ ├── R-qgis-extension.rsx │ └── scholar.Rd ├── C++ │ ├── render_adapter.cpp │ ├── bar.h │ ├── bar.hh │ ├── bar.hpp │ └── hello.cpp ├── Forth │ ├── hello-forth.fth │ ├── hello-forth.forth │ ├── enum.frt │ ├── macros.frt │ ├── bitmap.frt │ └── block.fth ├── GLSL │ ├── myfragment.frg │ ├── SimpleLighting.gl2.frag │ └── myvertex.vrx ├── Rebol │ ├── hello-world.reb │ ├── hello-world.r2 │ ├── hello-world.r3 │ └── hello-world.rebol ├── Pike │ └── shebang.pike ├── Parrot Assembly │ └── hello.pasm ├── Erlang │ ├── hello.escript │ └── factorial.script! ├── Parrot Internal Representation │ └── hello.pir ├── Arduino │ └── hello.ino ├── TeX │ └── verbose.bbx ├── Haskell │ └── Hello.hs ├── Handlebars │ ├── basic.handlebars │ └── each.hbs ├── XC │ └── main.xc ├── COBOL │ ├── hello_world.cbl │ ├── hello_world.cob │ ├── hello_world.ccp │ └── simple.cpy ├── Nemerle │ └── hello.n ├── Prolog │ ├── ex6.pl │ ├── dleak-report.script! │ ├── test-prolog.prolog │ └── turing.pl ├── RMarkdown │ └── example.rmd ├── AsciiDoc │ ├── list.asc │ ├── encoding.asciidoc │ └── sample.adoc ├── Diff │ └── dude-thing-okay--001.patch ├── G-code │ ├── square.g │ └── duettest.g ├── Kit │ └── demo.kit ├── YAML │ ├── filenames │ │ └── .gemrc │ └── vcr_cassette.yml ├── Perl6 │ ├── A.pm │ ├── ContainsUnicode.pm │ ├── grammar-test.p6 │ └── RoleQ.pm6 ├── JSON │ ├── product.json │ └── person.json ├── Scala │ └── scala.script! ├── Groff │ └── sample.4 ├── SQL │ ├── suspendedtoday.viw │ ├── object-update.udf │ ├── AvailableInSearchSel.prc │ └── filial.tab ├── SystemVerilog │ ├── util.vh │ ├── fifo.sv │ └── priority_encoder.sv ├── Clojure │ ├── rand.cljscm │ ├── hiccup.hic │ ├── protocol.cljs │ ├── into-array.cljc │ ├── for.clj │ ├── unit-test.cl2 │ └── svg.cljx ├── Inform 7 │ ├── Trivial Extension.i7x │ └── story.ni ├── SPARQL │ └── foaf.sparql ├── Moocode │ ├── hello.moo │ └── toy.moo ├── Grammatical Framework │ ├── FoodsCat.gf │ ├── FoodsFin.gf │ ├── FoodsGer.gf │ ├── FoodsIta.gf │ ├── FoodsSwe.gf │ ├── LexFoods.gf │ ├── Foods.gf │ ├── LexFoodsIta.gf │ ├── LexFoodsSwe.gf │ ├── FoodsAmh.gf │ ├── LexFoodsGer.gf │ ├── LexFoodsFin.gf │ ├── LexFoodsCat.gf │ └── FoodsOri.gf ├── Matlab │ ├── normalize.m │ ├── matlab_function.m │ ├── Check_plot.m │ ├── average.m │ ├── matlab_script.m │ ├── distance.m │ ├── Lagrangian_points.m │ ├── test_rk_par.m │ ├── matlab_script2.m │ ├── Poincare.m │ ├── ieee.m │ ├── RK4.m │ ├── Lagr.m │ ├── matlab_class.m │ └── par_text_to_struct.m ├── Grace │ └── ackerman_function.grace ├── Opa │ ├── hello_syntax1.opa │ └── hello_syntax2.opa ├── UnrealScript │ └── US3HelloWorld.uc ├── PigLatin │ └── example.pig ├── Scheme │ └── basic.sld ├── Hy │ ├── fibonacci.hy │ └── hello-world.hy ├── IDL │ ├── mg_analysis.dlm │ └── mg_acosh.pro ├── Sass │ └── screen.sass ├── Groovy Server Pages │ ├── hello-var.gsp │ ├── hello-resources.gsp │ ├── bar.gsp │ └── hello-pagedirective.gsp ├── E │ ├── Promises.E │ ├── IO.E │ ├── Functions.E │ └── minChat.E ├── AGS Script │ ├── GlobalScript.ash │ └── KeyboardMovement_102.ash ├── Public Key │ ├── id_rsa.pub │ ├── id.pub │ └── sunCert.asc ├── Clean │ ├── GenMap.dcl │ ├── stack.dcl │ ├── streams.dcl │ ├── GenHylo.dcl │ ├── GenMap.icl │ └── stack.icl ├── Gnuplot │ ├── rates.gp │ └── histograms.2.gnu ├── XML │ ├── sample.targets │ ├── libsomething.dll.config │ ├── phpunit.xml.dist │ ├── XmlIO.pluginspec │ ├── module.ant │ └── sample.nuspec ├── Less │ └── screen.less ├── SCSS │ └── screen.scss ├── F# │ └── sample.fs ├── VHDL │ └── foo.vhd ├── Pascal │ ├── program.dpr │ ├── tw27294.pp │ └── large.pp ├── SuperCollider │ └── WarpPreset.sc ├── Visual Basic │ └── Module1.vb ├── Graph Modeling Language │ └── sample.gml ├── Logtalk │ └── foo.lgt ├── CMake │ ├── filenames │ │ └── CMakeLists.txt │ ├── sample1.cmake │ ├── sample4.cmake │ └── sample2.cmake ├── Xojo │ ├── MyToolbar.xojo_toolbar │ ├── BillingReport.xojo_report │ └── database.xojo_script ├── KRL │ └── helloworld.krl ├── Mercury │ └── hello.m ├── Dogescript │ └── example.djs ├── Smalltalk │ └── testSimpleChainMatches.st ├── JSONiq │ ├── detail.jq │ └── query.jq ├── Puppet │ ├── stages-example.pp │ └── unmanaged-notify-puppet25.pp ├── XProc │ └── xproc.xpl ├── BlitzMax │ └── sample.bmx ├── IGOR Pro │ ├── generic.ipf │ └── functions.ipf ├── SAS │ ├── data.sas │ └── proc.sas ├── Ceylon │ └── Foo.ceylon ├── OpenCL │ ├── sample.cl │ └── fft.cl ├── Turtle │ └── rdf-syntax-grammar.ttl ├── BitBake │ └── qtbase-native.bb ├── Dart │ └── point.dart ├── Hack │ ├── startup.hh │ ├── index.hh │ ├── Request.hh │ ├── MySecureRequest.hh │ ├── RecipeWithDemo.hh │ ├── UnescapedString.hh │ ├── UsingUserID.hh │ └── Documentation.hh ├── Logos │ └── example.xm ├── Omgrofl │ └── hello.omgrofl ├── Common Lisp │ ├── sample.lisp │ └── sample.lsp ├── FORTRAN │ ├── sample1.f │ ├── sample1.for │ ├── sample2.f │ └── sample3.F ├── Turing │ └── turing.t ├── Opal │ └── DeepakChopra.opal ├── desktop │ └── example.desktop ├── ColdFusion CFC │ └── exampleTag.cfc ├── Gradle │ ├── builder.gradle │ └── build.gradle ├── C# │ ├── BsonPropertyValue.cs │ └── Program.cs ├── HTML │ └── example.xht ├── Stylus │ └── demo.styl ├── Lua │ └── h-counter.pd_lua ├── Protocol Buffer │ └── addressbook.proto ├── EmberScript │ └── momentComponent.em ├── XSLT │ └── test.xslt ├── APL │ └── DeepakChopra.apl ├── Racket │ └── 99-bottles-of-beer.scrbl ├── JSON5 │ └── example.json5 ├── GAP │ ├── factor.tst │ └── example.gd ├── Cool │ └── list.cl ├── Zimpl │ └── sample.zmpl ├── LiveScript │ └── hello.ls ├── SQF │ └── macros.hqf ├── Jasmin │ ├── op2.j │ └── if4.j ├── fish │ └── eval.fish ├── Golo │ └── helloworld.golo ├── Slim │ └── sample.slim ├── JSONLD │ └── sample.jsonld └── Processing │ └── hello.pde ├── test ├── fixtures │ ├── Data │ │ ├── blank │ │ ├── txt │ │ ├── md │ │ ├── defu.nkt │ │ ├── README │ │ ├── Modelines │ │ │ ├── iamphp.inc │ │ │ ├── example_smalltalk.md │ │ │ ├── ruby │ │ │ ├── not_perl.pl │ │ │ └── seeplusplus │ │ ├── cars.csv │ │ ├── utf16le │ │ ├── iso8859-8-i │ │ └── utf16le-windows │ ├── Binary │ │ ├── zip │ │ ├── dog.o │ │ ├── cube.stl │ │ ├── foo.bin │ │ ├── foo.pdf │ │ ├── foo.png │ │ ├── git.exe │ │ ├── foo bar.jar │ │ ├── hello.pbc │ │ ├── octocat.ai │ │ ├── octocat.png │ │ ├── octocat.psd │ │ ├── linguist.gem │ │ └── github.po │ └── Python │ │ └── run_tests.module ├── test_file_blob.rb └── helper.rb ├── lib ├── linguist │ ├── version.rb │ ├── grammars.rb │ ├── popular.yml │ ├── documentation.yml │ └── strategy │ │ └── filename.rb └── linguist.rb ├── package.json ├── .gitignore ├── Gemfile ├── .travis.yml ├── script ├── bootstrap ├── vendor-deb ├── cibuild └── travis │ └── before_install └── github-linguist-grammars.gemspec /.gitattributes: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/Text/foo.txt: -------------------------------------------------------------------------------- 1 | foo 2 | -------------------------------------------------------------------------------- /test/fixtures/Data/blank: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/Data/txt: -------------------------------------------------------------------------------- 1 | Text 2 | -------------------------------------------------------------------------------- /samples/STON/Array.ston: -------------------------------------------------------------------------------- 1 | [1, 2, 3] 2 | -------------------------------------------------------------------------------- /samples/Text/mac.txt: -------------------------------------------------------------------------------- 1 | line 1 line 2 -------------------------------------------------------------------------------- /test/fixtures/Data/md: -------------------------------------------------------------------------------- 1 | MD 2 | == 3 | -------------------------------------------------------------------------------- /samples/Ruby/foo.rb: -------------------------------------------------------------------------------- 1 | module Foo 2 | end 3 | -------------------------------------------------------------------------------- /samples/Tea/foo.tea: -------------------------------------------------------------------------------- 1 | <% template foo() %> -------------------------------------------------------------------------------- /samples/Text/readme.txt: -------------------------------------------------------------------------------- 1 | Read me now! 2 | -------------------------------------------------------------------------------- /test/fixtures/Data/defu.nkt: -------------------------------------------------------------------------------- 1 | defunkt 2 | -------------------------------------------------------------------------------- /samples/Emacs Lisp/dude.el: -------------------------------------------------------------------------------- 1 | (print "Dude!") 2 | -------------------------------------------------------------------------------- /samples/JavaScript/dude.js: -------------------------------------------------------------------------------- 1 | alert("dude!") 2 | -------------------------------------------------------------------------------- /samples/Markdown/tender.md: -------------------------------------------------------------------------------- 1 | Tender 2 | ====== 3 | -------------------------------------------------------------------------------- /samples/Ruby/grit.rb: -------------------------------------------------------------------------------- 1 | module Grit 2 | end 3 | -------------------------------------------------------------------------------- /test/fixtures/Data/README: -------------------------------------------------------------------------------- 1 | README 2 | ====== 3 | -------------------------------------------------------------------------------- /samples/Ant Build System/filenames/build.xml: -------------------------------------------------------------------------------- 1 | ant.xml -------------------------------------------------------------------------------- /samples/Nit/hello_world.nit: -------------------------------------------------------------------------------- 1 | print "hello world" 2 | -------------------------------------------------------------------------------- /samples/STON/Dictionary.ston: -------------------------------------------------------------------------------- 1 | {#a : 1, #b : 2} 2 | -------------------------------------------------------------------------------- /samples/Scilab/scilab_script.sce: -------------------------------------------------------------------------------- 1 | disp(%pi); 2 | 3 | -------------------------------------------------------------------------------- /samples/Shell/script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "sh" 3 | -------------------------------------------------------------------------------- /samples/Shell/sh.script!: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "sh" 3 | -------------------------------------------------------------------------------- /samples/Stata/limits.matah: -------------------------------------------------------------------------------- 1 | local MAXDIM 800 2 | -------------------------------------------------------------------------------- /samples/AutoHotkey/hello.ahk: -------------------------------------------------------------------------------- 1 | MsgBox, Hello`, World! 2 | -------------------------------------------------------------------------------- /samples/Cirru/require.cirru: -------------------------------------------------------------------------------- 1 | 2 | require ./stdio.cr 3 | -------------------------------------------------------------------------------- /samples/Haml/hello.haml: -------------------------------------------------------------------------------- 1 | %p 2 | Hello, 3 | World! 4 | -------------------------------------------------------------------------------- /samples/Jade/hello.jade: -------------------------------------------------------------------------------- 1 | p. 2 | Hello, 3 | World! 4 | -------------------------------------------------------------------------------- /samples/Scaml/hello.scaml: -------------------------------------------------------------------------------- 1 | %p 2 | Hello, 3 | World! 4 | -------------------------------------------------------------------------------- /samples/Shell/bash.script!: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "bash" 3 | -------------------------------------------------------------------------------- /samples/Shell/filenames/.bash_logout: -------------------------------------------------------------------------------- 1 | /usr/bin/clear 2 | -------------------------------------------------------------------------------- /samples/Shell/filenames/bash_logout: -------------------------------------------------------------------------------- 1 | /usr/bin/clear 2 | -------------------------------------------------------------------------------- /samples/Shell/script.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "bash" 3 | -------------------------------------------------------------------------------- /samples/Shell/script.zsh: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | echo "zsh" 3 | -------------------------------------------------------------------------------- /samples/Shell/zsh.script!: -------------------------------------------------------------------------------- 1 | #!/bin/zsh 2 | echo "zsh" 3 | -------------------------------------------------------------------------------- /samples/Swift/section-3.swift: -------------------------------------------------------------------------------- 1 | println("Hello, world") 2 | -------------------------------------------------------------------------------- /samples/OpenEdge ABL/openedge.p: -------------------------------------------------------------------------------- 1 | MESSAGE "Hello, world!". 2 | -------------------------------------------------------------------------------- /samples/TypeScript/hello.ts: -------------------------------------------------------------------------------- 1 | console.log("Hello, World!"); 2 | -------------------------------------------------------------------------------- /test/fixtures/Data/Modelines/iamphp.inc: -------------------------------------------------------------------------------- 1 | ; -*- MoDe: PhP;-*- 2 | -------------------------------------------------------------------------------- /samples/Cirru/number.cirru: -------------------------------------------------------------------------------- 1 | 2 | print $ int 1 3 | print $ float 1.2 -------------------------------------------------------------------------------- /samples/CoffeeScript/hello.coffee: -------------------------------------------------------------------------------- 1 | console.log "Hello, World!" 2 | -------------------------------------------------------------------------------- /samples/Gosu/hello.vark: -------------------------------------------------------------------------------- 1 | function hello() { 2 | print("hello") 3 | } -------------------------------------------------------------------------------- /samples/Nu/nu.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nush 2 | (puts "Hello") 3 | -------------------------------------------------------------------------------- /samples/Perl/script.pl: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl 2 | print "Perl\n" 3 | -------------------------------------------------------------------------------- /samples/Ruby/ruby.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | puts "Ruby" 3 | -------------------------------------------------------------------------------- /samples/Cirru/string.cirru: -------------------------------------------------------------------------------- 1 | 2 | print $ string a 3 | print $ string "a b" -------------------------------------------------------------------------------- /samples/PHP/prefix.fcgi: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /samples/Perl/perl.script!: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/perl 2 | print "Perl\n" 3 | -------------------------------------------------------------------------------- /samples/Shell/invalid-shebang.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env 2 | 3 | echo "wat" 4 | -------------------------------------------------------------------------------- /samples/Swift/section-45.swift: -------------------------------------------------------------------------------- 1 | numbers.map({ number in 3 * number }) 2 | -------------------------------------------------------------------------------- /samples/Swift/section-47.swift: -------------------------------------------------------------------------------- 1 | sort([1, 5, 3, 12, 2]) { $0 > $1 } 2 | -------------------------------------------------------------------------------- /samples/VimL/filenames/.gvimrc: -------------------------------------------------------------------------------- 1 | " no toolbar 2 | set guioptions-=T 3 | -------------------------------------------------------------------------------- /lib/linguist/version.rb: -------------------------------------------------------------------------------- 1 | module Linguist 2 | VERSION = "4.4.2" 3 | end 4 | -------------------------------------------------------------------------------- /samples/Coq/Sorting.v: -------------------------------------------------------------------------------- 1 | Require Export Sorted. 2 | Require Export Mergesort. 3 | -------------------------------------------------------------------------------- /samples/Groovy/groovy.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | println "Groovy!" 3 | -------------------------------------------------------------------------------- /samples/Groovy/script.gvy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | println "Hello World" 3 | -------------------------------------------------------------------------------- /samples/Ioke/hello.ik: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ioke 2 | 3 | "Hello world." println 4 | -------------------------------------------------------------------------------- /samples/JavaScript/js.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | console.log("Node") 3 | -------------------------------------------------------------------------------- /samples/JavaScript/outro.js.frag: -------------------------------------------------------------------------------- 1 | 2 | })(window, window.angular); 3 | 4 | -------------------------------------------------------------------------------- /samples/Makefile/makefile.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | %: 3 | ls -l 4 | -------------------------------------------------------------------------------- /samples/Nimrod/foo.nim: -------------------------------------------------------------------------------- 1 | # Hello world program 2 | 3 | echo "Hello world!" 4 | -------------------------------------------------------------------------------- /samples/PHP/php-script.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | echo $FOOBAR 2 | Hello World! 3 | -------------------------------------------------------------------------------- /test/fixtures/Data/Modelines/example_smalltalk.md: -------------------------------------------------------------------------------- 1 | ; -*-mode:Smalltalk-*- 2 | -------------------------------------------------------------------------------- /samples/Ruby/ruby2.script!: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env ruby -w -Ilib:test 2 | puts "Ruby" 3 | -------------------------------------------------------------------------------- /samples/Shell/filenames/.profile: -------------------------------------------------------------------------------- 1 | export PATH="/usr/local/bin:/usr/bin:/bin" 2 | -------------------------------------------------------------------------------- /samples/OpenSCAD/simple.scad: -------------------------------------------------------------------------------- 1 | // Simple sphere in OpenSCAD 2 | 3 | sphere( r=10 ); 4 | -------------------------------------------------------------------------------- /samples/SaltStack/top.sls: -------------------------------------------------------------------------------- 1 | base: 2 | '*': 3 | - packages 4 | - coffeestats 5 | -------------------------------------------------------------------------------- /samples/Shell/filenames/.zshenv: -------------------------------------------------------------------------------- 1 | fpath=($fpath $HOME/.zsh/func) 2 | typeset -U fpath 3 | -------------------------------------------------------------------------------- /samples/Shell/filenames/zshenv: -------------------------------------------------------------------------------- 1 | fpath=($fpath $HOME/.zsh/func) 2 | typeset -U fpath 3 | -------------------------------------------------------------------------------- /test/fixtures/Data/Modelines/ruby: -------------------------------------------------------------------------------- 1 | /* vim: set filetype=ruby: */ 2 | 3 | # I am Ruby 4 | -------------------------------------------------------------------------------- /samples/Mathematica/Init.m: -------------------------------------------------------------------------------- 1 | (* Mathematica Init File *) 2 | 3 | Get[ "Foobar`Foobar`"] 4 | -------------------------------------------------------------------------------- /samples/Objective-C/Foo.m: -------------------------------------------------------------------------------- 1 | #import "Foo.h" 2 | 3 | 4 | @implementation Foo 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /samples/Perl/test-perl2.pl: -------------------------------------------------------------------------------- 1 | 2 | # Perl file without shebang 3 | print "Hello, world!\n"; 4 | -------------------------------------------------------------------------------- /samples/Stata/common.doh: -------------------------------------------------------------------------------- 1 | local inname "inputdata.dta" 2 | local outname "outputdata.dta" 3 | -------------------------------------------------------------------------------- /samples/Stata/include.ihlp: -------------------------------------------------------------------------------- 1 | {* *! version 1.0.0 19mar2014}{...} 2 | Hello world!{p_end} 3 | -------------------------------------------------------------------------------- /samples/C/hello.h: -------------------------------------------------------------------------------- 1 | #ifndef HELLO_H 2 | #define HELLO_H 3 | 4 | void hello(); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /samples/Chapel/hello.chpl: -------------------------------------------------------------------------------- 1 | writeln("Hello, world!"); // print 'Hello, world!' to the console 2 | -------------------------------------------------------------------------------- /samples/INI/filenames/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Josh Peek 3 | email = josh@github.com 4 | -------------------------------------------------------------------------------- /samples/M/helloworld.m: -------------------------------------------------------------------------------- 1 | label1 ; This is a label 2 | write "Hello World !",! 3 | quit 4 | -------------------------------------------------------------------------------- /samples/Perl/use5.pl: -------------------------------------------------------------------------------- 1 | use Mojolicious::Lite; 2 | use 5.20.0; 3 | use experimental 'signatures'; 4 | -------------------------------------------------------------------------------- /samples/R/hello-r.R: -------------------------------------------------------------------------------- 1 | hello <- function() { 2 | print("hello, world!") 3 | } 4 | hello() 5 | -------------------------------------------------------------------------------- /samples/Ruby/script.rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | task :default do 3 | puts "Rake" 4 | end 5 | -------------------------------------------------------------------------------- /samples/Scilab/scilab_test.tst: -------------------------------------------------------------------------------- 1 | assert_checkequal(1+1,2); 2 | assert_checkfalse(%pi==%e); 3 | 4 | -------------------------------------------------------------------------------- /samples/Stata/hello.ado: -------------------------------------------------------------------------------- 1 | program hello 2 | vers 13 3 | 4 | display "Hello world!" 5 | end 6 | -------------------------------------------------------------------------------- /samples/Swift/section-17.swift: -------------------------------------------------------------------------------- 1 | shoppingList = [] // Went shopping and bought everything. 2 | -------------------------------------------------------------------------------- /samples/Swift/section-5.swift: -------------------------------------------------------------------------------- 1 | var myVariable = 42 2 | myVariable = 50 3 | let myConstant = 42 4 | -------------------------------------------------------------------------------- /samples/C++/render_adapter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace Gui 4 | { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /samples/Forth/hello-forth.fth: -------------------------------------------------------------------------------- 1 | : HELLO ( -- ) 2 | ." Hello Forth (fth)!" ; 3 | 4 | HELLO 5 | 6 | -------------------------------------------------------------------------------- /samples/JavaScript/hello.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | console.log("Hello, World!"); 3 | }).call(this); 4 | -------------------------------------------------------------------------------- /test/fixtures/Binary/zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/zip -------------------------------------------------------------------------------- /test/fixtures/Data/Modelines/not_perl.pl: -------------------------------------------------------------------------------- 1 | /* vim: set filEtype=pRoloG: */ 2 | 3 | # I am Prolog 4 | -------------------------------------------------------------------------------- /test/fixtures/Data/cars.csv: -------------------------------------------------------------------------------- 1 | Year,Make,Model,Length 2 | 1997,Ford,E350,2.34 3 | 2000,Mercury,Cougar,2.38 -------------------------------------------------------------------------------- /samples/Forth/hello-forth.forth: -------------------------------------------------------------------------------- 1 | : HELLO ( -- ) 2 | ." Hello Forth (forth)!" ; 3 | 4 | HELLO 5 | 6 | -------------------------------------------------------------------------------- /samples/Shell/string-chopping.script!: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | name=foodforthought.jpg 4 | echo ${name##*fo} 5 | -------------------------------------------------------------------------------- /test/fixtures/Binary/dog.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/dog.o -------------------------------------------------------------------------------- /test/fixtures/Data/Modelines/seeplusplus: -------------------------------------------------------------------------------- 1 | /* vim: set ft=cpp: */ 2 | 3 | I would like to be C++ please. 4 | -------------------------------------------------------------------------------- /test/fixtures/Data/utf16le: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Data/utf16le -------------------------------------------------------------------------------- /samples/GLSL/myfragment.frg: -------------------------------------------------------------------------------- 1 | varying vec4 v_color; 2 | 3 | void main() 4 | { 5 | gl_FragColor = v_color; 6 | } -------------------------------------------------------------------------------- /samples/Rebol/hello-world.reb: -------------------------------------------------------------------------------- 1 | Rebol [] 2 | hello: func [] [ 3 | print "hello, world!" 4 | ] 5 | hello 6 | -------------------------------------------------------------------------------- /test/fixtures/Binary/cube.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/cube.stl -------------------------------------------------------------------------------- /test/fixtures/Binary/foo.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/foo.bin -------------------------------------------------------------------------------- /test/fixtures/Binary/foo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/foo.pdf -------------------------------------------------------------------------------- /test/fixtures/Binary/foo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/foo.png -------------------------------------------------------------------------------- /test/fixtures/Binary/git.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/git.exe -------------------------------------------------------------------------------- /samples/Pike/shebang.pike: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env pike 2 | 3 | int main(int argc, array argv) { 4 | return 0; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /samples/Rebol/hello-world.r2: -------------------------------------------------------------------------------- 1 | REBOL [] 2 | 3 | hello: func [] [ 4 | print "hello, world!" 5 | ] 6 | 7 | hello 8 | -------------------------------------------------------------------------------- /samples/Rebol/hello-world.r3: -------------------------------------------------------------------------------- 1 | Rebol [] 2 | 3 | hello: func [] [ 4 | print "hello, world!" 5 | ] 6 | 7 | hello 8 | -------------------------------------------------------------------------------- /samples/Swift/section-15.swift: -------------------------------------------------------------------------------- 1 | let emptyArray = String[]() 2 | let emptyDictionary = Dictionary() 3 | -------------------------------------------------------------------------------- /test/fixtures/Binary/foo bar.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/foo bar.jar -------------------------------------------------------------------------------- /test/fixtures/Binary/hello.pbc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/hello.pbc -------------------------------------------------------------------------------- /test/fixtures/Binary/octocat.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/octocat.ai -------------------------------------------------------------------------------- /test/fixtures/Binary/octocat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/octocat.png -------------------------------------------------------------------------------- /test/fixtures/Binary/octocat.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/octocat.psd -------------------------------------------------------------------------------- /test/fixtures/Data/iso8859-8-i: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Data/iso8859-8-i -------------------------------------------------------------------------------- /samples/C/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Hello World\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /samples/Parrot Assembly/hello.pasm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env parrot 2 | 3 | .pcc_sub :main main: 4 | say "Hello!" 5 | end 6 | -------------------------------------------------------------------------------- /samples/STON/Rectangle.ston: -------------------------------------------------------------------------------- 1 | Rectangle { 2 | #origin : Point [ -40, -15 ], 3 | #corner : Point [ 60, 35 ] 4 | } 5 | -------------------------------------------------------------------------------- /samples/Swift/section-9.swift: -------------------------------------------------------------------------------- 1 | let label = "The width is " 2 | let width = 94 3 | let widthLabel = label + String(width) 4 | -------------------------------------------------------------------------------- /samples/Text/messages.fr: -------------------------------------------------------------------------------- 1 | the green potato=la pomme de terre verte 2 | le nouveau type de musique=the new type of music 3 | -------------------------------------------------------------------------------- /test/fixtures/Binary/linguist.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Binary/linguist.gem -------------------------------------------------------------------------------- /test/fixtures/Data/utf16le-windows: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mojombo/linguist/master/test/fixtures/Data/utf16le-windows -------------------------------------------------------------------------------- /samples/Swift/section-7.swift: -------------------------------------------------------------------------------- 1 | let implicitInteger = 70 2 | let implicitDouble = 70.0 3 | let explicitDouble: Double = 70 4 | -------------------------------------------------------------------------------- /samples/Erlang/hello.escript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | -export([main/1]). 3 | 4 | main([]) -> io:format("Hello, World!~n"). 5 | -------------------------------------------------------------------------------- /samples/PHP/exception.zep.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @interface Foo : NSObject { 5 | 6 | } 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /samples/Shell/filenames/.zlogout: -------------------------------------------------------------------------------- 1 | # Store dirs stack 2 | # See ~/.dotfiles/oh-my-zsh/plugins/dirspersist.plugin.zsh 3 | dirpersiststore 4 | -------------------------------------------------------------------------------- /samples/Shell/filenames/zlogout: -------------------------------------------------------------------------------- 1 | # Store dirs stack 2 | # See ~/.dotfiles/oh-my-zsh/plugins/dirspersist.plugin.zsh 3 | dirpersiststore 4 | -------------------------------------------------------------------------------- /samples/Swift/section-51.swift: -------------------------------------------------------------------------------- 1 | var shape = Shape() 2 | shape.numberOfSides = 7 3 | var shapeDescription = shape.simpleDescription() 4 | -------------------------------------------------------------------------------- /samples/TeX/verbose.bbx: -------------------------------------------------------------------------------- 1 | \ProvidesFile{verbose.bbx} 2 | [\abx@bbxid] 3 | 4 | \RequireBibliographyStyle{authortitle} 5 | 6 | \endinput 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "repository": "https://github.com/github/linguist", 3 | "dependencies": { 4 | "season": "~>5.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /samples/C++/bar.h: -------------------------------------------------------------------------------- 1 | class Bar 2 | { 3 | protected: 4 | 5 | char *name; 6 | 7 | public: 8 | 9 | void hello(); 10 | } 11 | -------------------------------------------------------------------------------- /samples/C++/bar.hh: -------------------------------------------------------------------------------- 1 | class Bar 2 | { 3 | protected: 4 | 5 | char *name; 6 | 7 | public: 8 | 9 | void hello(); 10 | } 11 | -------------------------------------------------------------------------------- /samples/Haskell/Hello.hs: -------------------------------------------------------------------------------- 1 | import Data.Char 2 | 3 | main :: IO () 4 | main = do 5 | let hello = "hello world" 6 | putStrLn $ map toUpper hello -------------------------------------------------------------------------------- /samples/Swift/section-33.swift: -------------------------------------------------------------------------------- 1 | func getGasPrices() -> (Double, Double, Double) { 2 | return (3.59, 3.69, 3.79) 3 | } 4 | getGasPrices() 5 | -------------------------------------------------------------------------------- /samples/Swift/section-43.swift: -------------------------------------------------------------------------------- 1 | numbers.map({ 2 | (number: Int) -> Int in 3 | let result = 3 * number 4 | return result 5 | }) 6 | -------------------------------------------------------------------------------- /samples/C++/bar.hpp: -------------------------------------------------------------------------------- 1 | class Bar 2 | { 3 | protected: 4 | 5 | char *name; 6 | 7 | public: 8 | 9 | void hello(); 10 | } 11 | -------------------------------------------------------------------------------- /samples/C++/hello.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | cout << "Hello World" << endl; 8 | } 9 | -------------------------------------------------------------------------------- /samples/Cirru/block.cirru: -------------------------------------------------------------------------------- 1 | 2 | set f $ block (a b c) 3 | print a b c 4 | 5 | call f (int 1) (int 2) (int 3) 6 | 7 | f (int 1) (int 2) (int 3) -------------------------------------------------------------------------------- /samples/Cirru/bool.cirru: -------------------------------------------------------------------------------- 1 | 2 | print $ bool true 3 | print $ bool false 4 | print $ bool yes 5 | print $ bool no 6 | print $ bool 1 7 | print $ bool 0 -------------------------------------------------------------------------------- /samples/Ruby/filenames/Capfile: -------------------------------------------------------------------------------- 1 | load 'deploy' 2 | Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } 3 | load 'config/deploy' 4 | -------------------------------------------------------------------------------- /samples/Swift/section-67.swift: -------------------------------------------------------------------------------- 1 | if let convertedRank = Rank.fromRaw(3) { 2 | let threeDescription = convertedRank.simpleDescription() 3 | } 4 | -------------------------------------------------------------------------------- /samples/Swift/section-75.swift: -------------------------------------------------------------------------------- 1 | protocol ExampleProtocol { 2 | var simpleDescription: String { get } 3 | mutating func adjust() 4 | } 5 | -------------------------------------------------------------------------------- /samples/Handlebars/basic.handlebars: -------------------------------------------------------------------------------- 1 |
2 |

{{title}}

3 |
4 | {{body}} 5 |
6 |
7 | -------------------------------------------------------------------------------- /samples/XC/main.xc: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int x; 4 | chan c; 5 | par { 6 | c <: 0; 7 | c :> x; 8 | } 9 | return x; 10 | } 11 | -------------------------------------------------------------------------------- /samples/COBOL/hello_world.cbl: -------------------------------------------------------------------------------- 1 | program-id. hello. 2 | procedure division. 3 | display "Hello, World!". 4 | stop run. 5 | 6 | -------------------------------------------------------------------------------- /samples/Nemerle/hello.n: -------------------------------------------------------------------------------- 1 | using System.Console; 2 | 3 | module Program 4 | { 5 | Main() : void 6 | { 7 | WriteLine("Hello world"); 8 | } 9 | } -------------------------------------------------------------------------------- /samples/VimL/filenames/.vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | set ignorecase 3 | set incsearch 4 | set smartcase 5 | set showmatch 6 | set showcmd 7 | 8 | syntax on 9 | -------------------------------------------------------------------------------- /samples/VimL/filenames/_vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | set ignorecase 3 | set incsearch 4 | set smartcase 5 | set showmatch 6 | set showcmd 7 | 8 | syntax on 9 | -------------------------------------------------------------------------------- /samples/Objective-C/hello.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | NSLog(@"Hello, World!\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /samples/Rebol/hello-world.rebol: -------------------------------------------------------------------------------- 1 | Rebol [ 2 | author: "Rebol user" 3 | ] 4 | 5 | hello: func [] [ 6 | print "hello, world!" 7 | ] 8 | 9 | hello 10 | -------------------------------------------------------------------------------- /samples/Swift/section-63.swift: -------------------------------------------------------------------------------- 1 | let optionalSquare: Square? = Square(sideLength: 2.5, name: "optional square") 2 | let sideLength = optionalSquare?.sideLength 3 | -------------------------------------------------------------------------------- /samples/Groovy/template.grt: -------------------------------------------------------------------------------- 1 | html { 2 | head { 3 | component "bootstrap" 4 | title "Bootstrap Template" 5 | } 6 | 7 | html { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/Prolog/ex6.pl: -------------------------------------------------------------------------------- 1 | %6.8 2 | subset(Set, Subset) :- 3 | append(L1, Subset, Set). 4 | powerset(Set, Subset) :- 5 | bagof(Subset, subset(Set, Subset), Subset). 6 | -------------------------------------------------------------------------------- /samples/Ruby/filenames/Appraisals: -------------------------------------------------------------------------------- 1 | appraise "rails32" do 2 | gem 'rails', '~> 3.2.0' 3 | end 4 | 5 | appraise "rails40" do 6 | gem 'rails', '~> 4.0.0' 7 | end 8 | -------------------------------------------------------------------------------- /samples/Shell/filenames/.cshrc: -------------------------------------------------------------------------------- 1 | umask 022 2 | set path=(/opt/local/bin /opt/local/sbin /bin /usr/bin) 3 | if ( $?prompt ) then 4 | set history=32 5 | endif 6 | -------------------------------------------------------------------------------- /samples/Shell/filenames/cshrc: -------------------------------------------------------------------------------- 1 | umask 022 2 | set path=(/opt/local/bin /opt/local/sbin /bin /usr/bin) 3 | if ( $?prompt ) then 4 | set history=32 5 | endif 6 | -------------------------------------------------------------------------------- /samples/Swift/section-31.swift: -------------------------------------------------------------------------------- 1 | func greet(name: String, day: String) -> String { 2 | return "Hello \(name), today is \(day)." 3 | } 4 | greet("Bob", "Tuesday") 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Gemfile.lock 2 | .bundle/ 3 | benchmark/ 4 | lib/linguist/samples.json 5 | /grammars 6 | /node_modules 7 | test/fixtures/ace_modes.json 8 | /vendor/gems/ 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gemspec :name => "github-linguist" 3 | gemspec :name => "github-linguist-grammars" 4 | gem 'byebug' if RUBY_VERSION >= '2.0' 5 | -------------------------------------------------------------------------------- /samples/RMarkdown/example.rmd: -------------------------------------------------------------------------------- 1 | # An example RMarkdown 2 | 3 | Some text. 4 | 5 | ## A graphic in R 6 | 7 | ```{r} 8 | plot(1:10) 9 | hist(rnorm(10000)) 10 | ``` -------------------------------------------------------------------------------- /samples/AsciiDoc/list.asc: -------------------------------------------------------------------------------- 1 | AsciiDoc Home Page 2 | ================== 3 | 4 | Example Articles 5 | ~~~~~~~~~~~~~~~~ 6 | - Item 1 7 | 8 | - Item 2 9 | 10 | - Item 3 11 | -------------------------------------------------------------------------------- /samples/Diff/dude-thing-okay--001.patch: -------------------------------------------------------------------------------- 1 | diff --git a/lib/linguist.rb b/lib/linguist.rb 2 | index d472341..8ad9ffb 100644 3 | --- a/lib/linguist.rb 4 | +++ b/lib/linguist.rb 5 | -------------------------------------------------------------------------------- /samples/G-code/square.g: -------------------------------------------------------------------------------- 1 | G28 X0 Y0 2 | G1 X55 Y5 F2000 3 | G1 Y180 4 | G1 X180 5 | G1 Y5 6 | G1 X55 7 | G1 Y180 8 | G1 X180 9 | G1 Y5 10 | G1 X55 11 | M0 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/Swift/section-27.swift: -------------------------------------------------------------------------------- 1 | var n = 2 2 | while n < 100 { 3 | n = n * 2 4 | } 5 | n 6 | 7 | var m = 2 8 | do { 9 | m = m * 2 10 | } while m < 100 11 | m 12 | -------------------------------------------------------------------------------- /samples/Swift/section-81.swift: -------------------------------------------------------------------------------- 1 | let protocolValue: ExampleProtocol = a 2 | protocolValue.simpleDescription 3 | // protocolValue.anotherProperty // Uncomment to see the error 4 | -------------------------------------------------------------------------------- /samples/COBOL/hello_world.cob: -------------------------------------------------------------------------------- 1 | IDENTIFICATION DIVISION. 2 | PROGRAM-ID. hello. 3 | PROCEDURE DIVISION. 4 | DISPLAY "Hello World!". 5 | STOP RUN. 6 | 7 | -------------------------------------------------------------------------------- /samples/Groovy/template.gtpl: -------------------------------------------------------------------------------- 1 | html { 2 | head { 3 | title "Example Template" 4 | } 5 | 6 | body { 7 | p "This is a quick template example" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/Kit/demo.kit: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

5 |

6 | 7 |

8 |
-------------------------------------------------------------------------------- /samples/R/R-qgis-extension.rsx: -------------------------------------------------------------------------------- 1 | ##polyg=vector 2 | ##numpoints=number 10 3 | ##output=output vector 4 | ##[Example scripts]=group 5 | pts=spsample(polyg,numpoints,type="regular") 6 | -------------------------------------------------------------------------------- /samples/YAML/filenames/.gemrc: -------------------------------------------------------------------------------- 1 | gem: --local --gen-rdoc --run-tests 2 | rdoc: --inline-source --line-numbers 3 | gempath: 4 | - /usr/local/rubygems 5 | - /home/gavin/.rubygems 6 | -------------------------------------------------------------------------------- /samples/Stata/tanh.mata: -------------------------------------------------------------------------------- 1 | numeric matrix tanh(numeric matrix u) 2 | { 3 | numeric matrix eu, emu 4 | 5 | eu = exp(u) 6 | emu = exp(-u) 7 | return( (eu-emu):/(eu+emu) ) 8 | } 9 | -------------------------------------------------------------------------------- /samples/Swift/section-11.swift: -------------------------------------------------------------------------------- 1 | let apples = 3 2 | let oranges = 5 3 | let appleSummary = "I have \(apples) apples." 4 | let fruitSummary = "I have \(apples + oranges) pieces of fruit." 5 | -------------------------------------------------------------------------------- /samples/COBOL/hello_world.ccp: -------------------------------------------------------------------------------- 1 | IDENTIFICATION DIVISION. 2 | PROGRAM-ID. hello. 3 | PROCEDURE DIVISION. 4 | DISPLAY "Hello World, yet again.". 5 | STOP RUN. 6 | 7 | -------------------------------------------------------------------------------- /samples/Cirru/array.cirru: -------------------------------------------------------------------------------- 1 | 2 | print $ array 3 | int 1 4 | string 2 5 | 6 | print $ array 7 | int 1 8 | array 9 | int 2 10 | string 3 11 | array 12 | string 4 -------------------------------------------------------------------------------- /samples/Perl/strict.t: -------------------------------------------------------------------------------- 1 | use Test::Base; 2 | 3 | __DATA__ 4 | === Strict Test 5 | 6 | --- perl strict 7 | my $x = 5; 8 | --- strict 9 | use strict; 10 | use warnings; 11 | my $x = 5; -------------------------------------------------------------------------------- /samples/Perl6/A.pm: -------------------------------------------------------------------------------- 1 | # used in t/spec/S11-modules/nested.t 2 | 3 | BEGIN { @*INC.push('t/spec/packages') }; 4 | 5 | module A::A { 6 | use A::B; 7 | } 8 | 9 | # vim: ft=perl6 10 | -------------------------------------------------------------------------------- /samples/JSON/product.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "name": "Foo", 4 | "price": 123, 5 | "tags": ["Bar","Eek"], 6 | "stock": { "warehouse":300, "retail":20 } 7 | } -------------------------------------------------------------------------------- /samples/Scala/scala.script!: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec scala "$0" "$@" 3 | !# 4 | 5 | object HelloWorld { 6 | def main(args: Array[String]) { 7 | println("Hello, world!") 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/Swift/section-49.swift: -------------------------------------------------------------------------------- 1 | class Shape { 2 | var numberOfSides = 0 3 | func simpleDescription() -> String { 4 | return "A shape with \(numberOfSides) sides." 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /samples/Groff/sample.4: -------------------------------------------------------------------------------- 1 | .TH FOO 1 2 | .SH NAME 3 | foo \- bar 4 | .SH SYNOPSIS 5 | .B foo 6 | .I bar 7 | .SH DESCRIPTION 8 | Foo bar 9 | .BR baz 10 | quux. 11 | .PP 12 | .B Foo 13 | bar baz. 14 | -------------------------------------------------------------------------------- /samples/SQL/suspendedtoday.viw: -------------------------------------------------------------------------------- 1 | use translog; 2 | DROP VIEW IF EXISTS `suspendedtoday`; 3 | 4 | create view suspendedtoday as 5 | select * from suspended 6 | where datediff(datetime, now()) = 0; 7 | -------------------------------------------------------------------------------- /samples/Swift/section-37.swift: -------------------------------------------------------------------------------- 1 | func returnFifteen() -> Int { 2 | var y = 10 3 | func add() { 4 | y += 5 5 | } 6 | add() 7 | return y 8 | } 9 | returnFifteen() 10 | -------------------------------------------------------------------------------- /samples/SystemVerilog/util.vh: -------------------------------------------------------------------------------- 1 | function integer log2; 2 | input integer x; 3 | begin 4 | x = x-1; 5 | for (log2 = 0; x > 0; log2 = log2 + 1) 6 | x = x >> 1; 7 | end 8 | endfunction 9 | -------------------------------------------------------------------------------- /samples/Clojure/rand.cljscm: -------------------------------------------------------------------------------- 1 | (defn rand 2 | "Returns a random floating point number between 0 (inclusive) and 3 | n (default 1) (exclusive)." 4 | ([] (scm* [n] (random-real))) 5 | ([n] (* (rand) n))) -------------------------------------------------------------------------------- /samples/Inform 7/Trivial Extension.i7x: -------------------------------------------------------------------------------- 1 | Version 1 of Trivial Extension by Andrew Plotkin begins here. 2 | 3 | A cow is a kind of animal. A cow can be purple. 4 | 5 | Trivial Extension ends here. 6 | 7 | -------------------------------------------------------------------------------- /samples/Perl/perl-test.t: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | 4 | use Foo::Bar 5 | 6 | $n = 42; 7 | $name = "world"; 8 | @array = ("1","2","3"); 9 | %hash = ("foo":"bar"); 10 | my $name = "josh"; 11 | -------------------------------------------------------------------------------- /samples/SPARQL/foaf.sparql: -------------------------------------------------------------------------------- 1 | PREFIX foaf: 2 | SELECT ?name ?email 3 | WHERE { 4 | ?person a foaf:Person. 5 | ?person foaf:name ?name. 6 | ?person foaf:mbox ?email. 7 | } 8 | -------------------------------------------------------------------------------- /samples/JavaScript/intro.js.frag: -------------------------------------------------------------------------------- 1 | (function(window, angular) { 2 | 3 | Array.prototype.last = function() { 4 | return this[this.length-1]; 5 | }; 6 | 7 | var app = angular.module('ConwayGameOfLife', []); 8 | -------------------------------------------------------------------------------- /samples/Perl6/ContainsUnicode.pm: -------------------------------------------------------------------------------- 1 | module ContainsUnicode { 2 | sub uc-and-join(*@things, :$separator = ', ') is export { 3 | @things».uc.join($separator) 4 | } 5 | } 6 | 7 | # vim: ft=perl6 8 | -------------------------------------------------------------------------------- /samples/GLSL/SimpleLighting.gl2.frag: -------------------------------------------------------------------------------- 1 | static const char* SimpleFragmentShader = STRINGIFY( 2 | 3 | varying vec4 FrontColor; 4 | 5 | void main(void) 6 | { 7 | gl_FragColor = FrontColor; 8 | } 9 | ); 10 | -------------------------------------------------------------------------------- /samples/Moocode/hello.moo: -------------------------------------------------------------------------------- 1 | @program toy:wind 2 | this.wound = this.wound + 2; 3 | player:tell("You wind up the ", this.name,"."); 4 | player.location:announce(player.name, " winds up the ", this.name,"."); 5 | . 6 | -------------------------------------------------------------------------------- /samples/SystemVerilog/fifo.sv: -------------------------------------------------------------------------------- 1 | module fifo ( 2 | input clk_50, 3 | input clk_2, 4 | input reset_n, 5 | output [7:0] data_out, 6 | output empty 7 | ); 8 | -------------------------------------------------------------------------------- /samples/Gosu/Hello.gst: -------------------------------------------------------------------------------- 1 | <%!-- defined in Hello.gst --%> 2 | 3 | <%@ params( users : Collection ) %> 4 | 5 | <% for( user in users ) { %> 6 | 7 | ${user.LastName}, ${user.FirstName}, ${user.Department} <% } %> -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsCat.gf: -------------------------------------------------------------------------------- 1 | --# -path=.:present 2 | 3 | -- (c) 2009 Jordi Saludes under LGPL 4 | 5 | concrete FoodsCat of Foods = FoodsI with 6 | (Syntax = SyntaxCat), 7 | (LexFoods = LexFoodsCat) ; 8 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsFin.gf: -------------------------------------------------------------------------------- 1 | --# -path=.:present 2 | 3 | -- (c) 2009 Aarne Ranta under LGPL 4 | 5 | concrete FoodsFin of Foods = FoodsI with 6 | (Syntax = SyntaxFin), 7 | (LexFoods = LexFoodsFin) ; 8 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsGer.gf: -------------------------------------------------------------------------------- 1 | --# -path=.:present 2 | 3 | -- (c) 2009 Aarne Ranta under LGPL 4 | 5 | concrete FoodsGer of Foods = FoodsI with 6 | (Syntax = SyntaxGer), 7 | (LexFoods = LexFoodsGer) ; 8 | -------------------------------------------------------------------------------- /samples/M/mileage.m: -------------------------------------------------------------------------------- 1 | compute(miles,gallons) 2 | quit miles/gallons 3 | 4 | computepesimist(miles,gallons) 5 | quit miles/(gallons+1) 6 | 7 | computeoptimist(miles,gallons) 8 | quit (miles+1)/gallons 9 | 10 | -------------------------------------------------------------------------------- /samples/Forth/enum.frt: -------------------------------------------------------------------------------- 1 | \ Implements ENUM. 2 | 3 | \ Double DOES>! 4 | : enum create 0 , does> create dup @ 1 rot +! , does> @ ; 5 | 6 | \ But this is simpler. 7 | : enum create 0 , does> dup @ constant 1 swap +! ; 8 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsIta.gf: -------------------------------------------------------------------------------- 1 | --# -path=.:present 2 | 3 | -- (c) 2009 Aarne Ranta under LGPL 4 | 5 | concrete FoodsIta of Foods = FoodsI with 6 | (Syntax = SyntaxIta), 7 | (LexFoods = LexFoodsIta) ; 8 | 9 | -------------------------------------------------------------------------------- /samples/Matlab/normalize.m: -------------------------------------------------------------------------------- 1 | function [ d, d_mean, d_std ] = normalize( d ) 2 | d_mean = mean(d); 3 | d = d - repmat(d_mean, size(d,1), 1); 4 | d_std = std(d); 5 | d = d./ repmat(d_std, size(d,1), 1); 6 | end 7 | -------------------------------------------------------------------------------- /samples/Cirru/map.cirru: -------------------------------------------------------------------------------- 1 | 2 | print $ map 3 | a $ int 5 4 | b $ array (int 1) (int 2) 5 | c $ map 6 | int 1 7 | array (int 4) 8 | 9 | set m $ map 10 | a $ int 1 11 | 12 | set m b $ int 2 13 | 14 | print m -------------------------------------------------------------------------------- /samples/Grace/ackerman_function.grace: -------------------------------------------------------------------------------- 1 | method ack (m : Number, n : Number) -> Number { 2 | print "ack {m} {n}" 3 | if (m < = 0) then {n + 1} 4 | elseif {n <= 0} then {ack((m -1), 1)} 5 | else {ack(m -1, ack(m, n-1))} 6 | } -------------------------------------------------------------------------------- /samples/Opa/hello_syntax1.opa: -------------------------------------------------------------------------------- 1 | /** 2 | * To compile & run on port 8080: 3 | * opa hello_syntax1.opa -- 4 | */ 5 | server = Server.one_page_server( 6 | "Hello, world", 7 | -> (

Hello, world

) 8 | ) 9 | 10 | -------------------------------------------------------------------------------- /samples/Swift/section-35.swift: -------------------------------------------------------------------------------- 1 | func sumOf(numbers: Int...) -> Int { 2 | var sum = 0 3 | for number in numbers { 4 | sum += number 5 | } 6 | return sum 7 | } 8 | sumOf() 9 | sumOf(42, 597, 12) 10 | -------------------------------------------------------------------------------- /samples/Clojure/hiccup.hic: -------------------------------------------------------------------------------- 1 | [:html 2 | [:head 3 | [:meta {:charset "utf-8"}] 4 | [:link {:rel "stylesheet" :href "css/bootstrap.min.css"}] 5 | [:script {:src "app.js"}]] 6 | [:body 7 | [:div.nav 8 | [:p "Hello world!"]]]] 9 | -------------------------------------------------------------------------------- /samples/JavaScript/helloHanaMath.xsjslib: -------------------------------------------------------------------------------- 1 | /* simple hana xs demo library, which can be used by multiple endpoints */ 2 | 3 | function multiply(x, y) { 4 | return x * y; 5 | } 6 | 7 | function add(x, y) { 8 | return x + y; 9 | } -------------------------------------------------------------------------------- /samples/M/fibonacci.m: -------------------------------------------------------------------------------- 1 | start ; compute the Fibonacci series 2 | set (a,b)=1 3 | for i=1:1 do quit:term>100 4 | . set term=a+b 5 | . write !,term 6 | . set a=b 7 | . set b=term 8 | write !,"Result= ",term,! 9 | quit 10 | -------------------------------------------------------------------------------- /samples/UnrealScript/US3HelloWorld.uc: -------------------------------------------------------------------------------- 1 | class US3HelloWorld extends GameInfo; 2 | 3 | event InitGame( string Options, out string Error ) 4 | { 5 | `log( "Hello, world!" ); 6 | } 7 | 8 | defaultproperties 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | before_install: script/travis/before_install 3 | rvm: 4 | - 1.9.3 5 | - 2.0.0 6 | - 2.1 7 | - 2.2 8 | notifications: 9 | disabled: true 10 | git: 11 | submodules: false 12 | cache: bundler 13 | -------------------------------------------------------------------------------- /samples/PigLatin/example.pig: -------------------------------------------------------------------------------- 1 | /** 2 | * sample.pig 3 | */ 4 | 5 | REGISTER $SOME_JAR; 6 | 7 | A = LOAD 'person' USING PigStorage() AS (name:chararray, age:int); -- Load person 8 | B = FOREACH A generate name; 9 | DUMP B; 10 | 11 | -------------------------------------------------------------------------------- /samples/Swift/section-39.swift: -------------------------------------------------------------------------------- 1 | func makeIncrementer() -> (Int -> Int) { 2 | func addOne(number: Int) -> Int { 3 | return 1 + number 4 | } 5 | return addOne 6 | } 7 | var increment = makeIncrementer() 8 | increment(7) 9 | -------------------------------------------------------------------------------- /samples/Scheme/basic.sld: -------------------------------------------------------------------------------- 1 | (define-library (libs basic) 2 | (export list2 x) 3 | (begin 4 | (define (list2 . objs) objs) 5 | (define x 'libs-basic) 6 | (define not-exported 'should-not-be-exported) 7 | )) 8 | -------------------------------------------------------------------------------- /samples/GLSL/myvertex.vrx: -------------------------------------------------------------------------------- 1 | uniform mat4 u_MVPMatrix; 2 | 3 | attribute vec4 a_position; 4 | attribute vec4 a_color; 5 | 6 | varying vec4 v_color; 7 | 8 | void main() 9 | { 10 | v_color = a_color; 11 | gl_Position = u_MVPMatrix * pos; 12 | } -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsSwe.gf: -------------------------------------------------------------------------------- 1 | --# -path=.:present 2 | 3 | -- (c) 2009 Aarne Ranta under LGPL 4 | 5 | concrete FoodsSwe of Foods = FoodsI with 6 | (Syntax = SyntaxSwe), 7 | (LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ; 8 | -------------------------------------------------------------------------------- /samples/Hy/fibonacci.hy: -------------------------------------------------------------------------------- 1 | ;; Fibonacci example in Hy. 2 | 3 | (defn fib [n] 4 | (if (<= n 2) n 5 | (+ (fib (- n 1)) (fib (- n 2))))) 6 | 7 | (if (= __name__ "__main__") 8 | (for [x [1 2 3 4 5 6 7 8]] 9 | (print (fib x)))) 10 | -------------------------------------------------------------------------------- /samples/INI/filenames/.editorconfig: -------------------------------------------------------------------------------- 1 | ; editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | -------------------------------------------------------------------------------- /samples/QMake/functions.pri: -------------------------------------------------------------------------------- 1 | # QMake include file that calls some functions 2 | # and does nothing else... 3 | 4 | exists(.git/HEAD) { 5 | system(git rev-parse HEAD >rev.txt) 6 | } else { 7 | system(echo ThisIsNotAGitRepo >rev.txt) 8 | } 9 | -------------------------------------------------------------------------------- /samples/Swift/section-29.swift: -------------------------------------------------------------------------------- 1 | var firstForLoop = 0 2 | for i in 0..3 { 3 | firstForLoop += i 4 | } 5 | firstForLoop 6 | 7 | var secondForLoop = 0 8 | for var i = 0; i < 3; ++i { 9 | secondForLoop += 1 10 | } 11 | secondForLoop 12 | -------------------------------------------------------------------------------- /samples/Swift/section-83.swift: -------------------------------------------------------------------------------- 1 | func repeat(item: ItemType, times: Int) -> ItemType[] { 2 | var result = ItemType[]() 3 | for i in 0..times { 4 | result += item 5 | } 6 | return result 7 | } 8 | repeat("knock", 4) 9 | -------------------------------------------------------------------------------- /samples/Swift/section-85.swift: -------------------------------------------------------------------------------- 1 | // Reimplement the Swift standard library's optional type 2 | enum OptionalValue { 3 | case None 4 | case Some(T) 5 | } 6 | var possibleInteger: OptionalValue = .None 7 | possibleInteger = .Some(100) 8 | -------------------------------------------------------------------------------- /samples/Gosu/Hello.gsx: -------------------------------------------------------------------------------- 1 | package example 2 | 3 | enhancement Hello : String { 4 | 5 | function toPerson() : Person { 6 | var vals = this.split(",") 7 | return new Person( vals[0], vals[1] as int, Relationship.valueOf( vals[2] ) ) ) 8 | } 9 | } -------------------------------------------------------------------------------- /samples/IDL/mg_analysis.dlm: -------------------------------------------------------------------------------- 1 | MODULE mg_analysis 2 | DESCRIPTION Tools for analysis 3 | VERSION 1.0 4 | SOURCE mgalloy 5 | BUILD_DATE January 18, 2011 6 | 7 | FUNCTION MG_ARRAY_EQUAL 2 2 KEYWORDS 8 | FUNCTION MG_TOTAL 1 1 9 | 10 | -------------------------------------------------------------------------------- /samples/Sass/screen.sass: -------------------------------------------------------------------------------- 1 | $blue: #3bbfce 2 | $margin: 16px 3 | 4 | .content-navigation 5 | border-color: $blue 6 | color: darken($blue, 9%) 7 | 8 | .border 9 | padding: $margin / 2 10 | margin: $margin / 2 11 | border-color: $blue 12 | -------------------------------------------------------------------------------- /samples/Swift/section-21.swift: -------------------------------------------------------------------------------- 1 | var optionalString: String? = "Hello" 2 | optionalString == nil 3 | 4 | var optionalName: String? = "John Appleseed" 5 | var greeting = "Hello!" 6 | if let name = optionalName { 7 | greeting = "Hello, \(name)" 8 | } 9 | -------------------------------------------------------------------------------- /samples/Groovy Server Pages/hello-var.gsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Testing with SiteMesh and ${example} 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/Objective-C/FooAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FooAppDelegate : NSObject { 4 | @private 5 | NSWindow *window; 6 | } 7 | 8 | @property (assign) IBOutlet NSWindow *window; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /samples/Prolog/dleak-report.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env swipl 2 | 3 | :- set_prolog_flag(verbose, silent). 4 | :- use_module(dleak). 5 | 6 | :- initialization 7 | main, halt. 8 | 9 | main :- 10 | current_prolog_flag(argv, [File]), 11 | dleak(File). 12 | -------------------------------------------------------------------------------- /samples/E/Promises.E: -------------------------------------------------------------------------------- 1 | # E snippet from 2 | # http://wiki.erights.org/wiki/Walnut/Distributed_Computing/Promises 3 | when (tempVow) -> { 4 | #...use tempVow 5 | } catch prob { 6 | #.... report problem 7 | } finally { 8 | #....log event 9 | } 10 | -------------------------------------------------------------------------------- /samples/Matlab/matlab_function.m: -------------------------------------------------------------------------------- 1 | function ret = matlab_function(A,B) 2 | % Simple function adding two values and displaying the return value 3 | 4 | ret = A+B; 5 | % Display the return value 6 | disp('Return value in function'); 7 | disp(ret); 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/Swift/section-61.swift: -------------------------------------------------------------------------------- 1 | class Counter { 2 | var count: Int = 0 3 | func incrementBy(amount: Int, numberOfTimes times: Int) { 4 | count += amount * times 5 | } 6 | } 7 | var counter = Counter() 8 | counter.incrementBy(2, numberOfTimes: 7) 9 | -------------------------------------------------------------------------------- /samples/Swift/section-79.swift: -------------------------------------------------------------------------------- 1 | extension Int: ExampleProtocol { 2 | var simpleDescription: String { 3 | return "The number \(self)" 4 | } 5 | mutating func adjust() { 6 | self += 42 7 | } 8 | } 9 | 7.simpleDescription 10 | -------------------------------------------------------------------------------- /samples/AGS Script/GlobalScript.ash: -------------------------------------------------------------------------------- 1 | // Main header script - this will be included into every script in 2 | // the game (local and global). Do not place functions here; rather, 3 | // place import definitions and #define names here to be used by all 4 | // scripts. 5 | -------------------------------------------------------------------------------- /samples/Matlab/Check_plot.m: -------------------------------------------------------------------------------- 1 | x_0=linspace(0,100,101); 2 | vx_0=linspace(0,100,101); 3 | z=zeros(101,101); 4 | for i=1:101 5 | for j=1:101 6 | z(i,j)=x_0(i)*vx_0(j); 7 | end 8 | end 9 | 10 | figure 11 | pcolor(x_0,vx_0,z) 12 | shading flat -------------------------------------------------------------------------------- /samples/Public Key/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCw3QQtYgRViVH8ZpkQ2A7BuCeyPYC4hB9kKNhxwUfJ2hFgW8soGMBhsLN+vOeAJ2IXDMsezJO2/qhoZFQMvHoWpWTRTLPeNtBsKD+nhOZX28A4D+QRzVZ6hdWoh9W+mIP69MIT3aX35oLb86IycbNdRJlEK4FAUt7tjezNkU7boQ== root@use1-2.nitrousbox.com 2 | -------------------------------------------------------------------------------- /samples/Swift/section-19.swift: -------------------------------------------------------------------------------- 1 | let individualScores = [75, 43, 103, 87, 12] 2 | var teamScore = 0 3 | for score in individualScores { 4 | if score > 50 { 5 | teamScore += 3 6 | } else { 7 | teamScore += 1 8 | } 9 | } 10 | teamScore 11 | -------------------------------------------------------------------------------- /lib/linguist.rb: -------------------------------------------------------------------------------- 1 | require 'linguist/blob_helper' 2 | require 'linguist/generated' 3 | require 'linguist/heuristics' 4 | require 'linguist/language' 5 | require 'linguist/repository' 6 | require 'linguist/samples' 7 | require 'linguist/shebang' 8 | require 'linguist/version' 9 | -------------------------------------------------------------------------------- /samples/COBOL/simple.cpy: -------------------------------------------------------------------------------- 1 | 01 COBOL-TEST-RECORD. 2 | 05 COBOL-TEST-USAGES. 3 | 10 COBOL-4-COMP PIC S9(4) COMP. 4 | 10 COBOL-8-COMP PIC S9(8) COMP. 5 | 10 COBOL-9-COMP PIC S9(9) COMP. 6 | 10 COBOL-4-COMP2 PIC S9(4) COMP-2. 7 | 10 COBOL-7-COMP2 PIC 9(7) COMP-2. 8 | -------------------------------------------------------------------------------- /samples/Clean/GenMap.dcl: -------------------------------------------------------------------------------- 1 | definition module GenMap 2 | 3 | import StdGeneric 4 | 5 | generic gMap a b :: .a -> .b 6 | derive gMap c, UNIT, PAIR, EITHER, CONS, FIELD, OBJECT, {}, {!} 7 | 8 | derive gMap [], (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,) 9 | 10 | -------------------------------------------------------------------------------- /samples/Gnuplot/rates.gp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env gnuplot 2 | 3 | reset 4 | 5 | set terminal png 6 | set output 'rates100.png' 7 | 8 | set xlabel "A2A price" 9 | set ylabel "Response Rate" 10 | 11 | #set xr [0:5] 12 | #set yr [0:6] 13 | 14 | plot 'rates100.dat' pt 7 notitle 15 | -------------------------------------------------------------------------------- /samples/Swift/section-13.swift: -------------------------------------------------------------------------------- 1 | var shoppingList = ["catfish", "water", "tulips", "blue paint"] 2 | shoppingList[1] = "bottle of water" 3 | 4 | var occupations = [ 5 | "Malcolm": "Captain", 6 | "Kaylee": "Mechanic", 7 | ] 8 | occupations["Jayne"] = "Public Relations" 9 | -------------------------------------------------------------------------------- /samples/Groovy Server Pages/hello-resources.gsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Testing with Resources 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/XML/sample.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | MyCommon 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/Less/screen.less: -------------------------------------------------------------------------------- 1 | @blue: #3bbfce; 2 | @margin: 16px; 3 | 4 | .content-navigation { 5 | border-color: @blue; 6 | color: 7 | darken(@blue, 9%); 8 | } 9 | 10 | .border { 11 | padding: @margin / 2; 12 | margin: @margin / 2; 13 | border-color: @blue; 14 | } 15 | -------------------------------------------------------------------------------- /samples/M/primes.m: -------------------------------------------------------------------------------- 1 | ; part of Keith Lynch's .signature; it prints a table of primes, 2 | ; including code to format it neatly into columns -- DPBS 3 | ; -- M Technology and MUMPS Language FAQ, Part 1/2 4 | ; 5 | 6 | f p=2,3:2 s q=1 x "f f=3:2 q:f*f>p!'q s q=p#f" w:q p,?$x\8+1*8 7 | -------------------------------------------------------------------------------- /samples/Opa/hello_syntax2.opa: -------------------------------------------------------------------------------- 1 | /** 2 | * To compile & run on port 8080: 3 | * opa --parser js-like hello_syntax2.opa -- 4 | */ 5 | Server.start( 6 | Server.http, 7 | { 8 | page: function() {

Hello, world

}, 9 | title: "Hello, world" 10 | } 11 | ) 12 | -------------------------------------------------------------------------------- /samples/SCSS/screen.scss: -------------------------------------------------------------------------------- 1 | $blue: #3bbfce; 2 | $margin: 16px; 3 | 4 | .content-navigation { 5 | border-color: $blue; 6 | color: 7 | darken($blue, 9%); 8 | } 9 | 10 | .border { 11 | padding: $margin / 2; 12 | margin: $margin / 2; 13 | border-color: $blue; 14 | } 15 | -------------------------------------------------------------------------------- /samples/SQL/object-update.udf: -------------------------------------------------------------------------------- 1 | 2 | if not exists(select * from sysobjects where name = '%object_name%' and type in (N'FN', N'IF', N'TF', N'FS', N'FT')) 3 | exec('create FUNCTION dbo.%object_name%() returns int as begin return null end') 4 | GO 5 | 6 | %object_ddl% 7 | 8 | go 9 | -------------------------------------------------------------------------------- /script/bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | bundle config --local path vendor/gems 8 | 9 | bundle check > /dev/null 2>&1 || bundle install 10 | 11 | git submodule init 12 | git submodule sync --quiet 13 | script/fast-submodule-update 14 | -------------------------------------------------------------------------------- /samples/Forth/macros.frt: -------------------------------------------------------------------------------- 1 | \ Simplifies compiling words. 2 | 3 | : [[ ; immediate 4 | : '<> >in @ ' swap >in ! <> ; 5 | : (]]) begin dup '<> while postpone postpone repeat drop ; 6 | : ]] ['] [[ (]]) ; immediate 7 | 8 | ( Usage: : foo ]] dup * [[ ; immediate : bar 42 foo . ; ) 9 | -------------------------------------------------------------------------------- /samples/C/syscalldefs.h: -------------------------------------------------------------------------------- 1 | static const syscalldef syscalldefs[] = { 2 | [SYSCALL_OR_NUM(0, SYS_restart_syscall)] = MAKE_UINT16(0, 1), 3 | [SYSCALL_OR_NUM(1, SYS_exit)] = MAKE_UINT16(1, 17), 4 | [SYSCALL_OR_NUM(2, SYS_fork)] = MAKE_UINT16(0, 22), 5 | }; 6 | -------------------------------------------------------------------------------- /samples/F#/sample.fs: -------------------------------------------------------------------------------- 1 | module Sample 2 | 3 | open System 4 | 5 | type Foo = 6 | { 7 | Bar : string 8 | } 9 | 10 | type Baz = interface end 11 | 12 | let Sample1(xs : int list) : string = 13 | xs 14 | |> List.map (fun x -> string x) 15 | |> String.concat "," 16 | -------------------------------------------------------------------------------- /samples/Handlebars/each.hbs: -------------------------------------------------------------------------------- 1 |
2 |

By {{fullName author}}

3 |
{{body}}
4 | 5 |

Comments

6 | 7 | {{#each comments}} 8 |

By {{fullName author}}

9 |
{{body}}
10 | {{/each}} 11 |
12 | -------------------------------------------------------------------------------- /samples/VHDL/foo.vhd: -------------------------------------------------------------------------------- 1 | -- VHDL example file 2 | 3 | library ieee; 4 | use ieee.std_logic_1164.all; 5 | 6 | entity inverter is 7 | port(a : in std_logic; 8 | b : out std_logic); 9 | end entity; 10 | 11 | architecture rtl of inverter is 12 | begin 13 | b <= not a; 14 | end architecture; 15 | -------------------------------------------------------------------------------- /samples/Objective-C/FooAppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "FooAppDelegate.h" 2 | 3 | @implementation FooAppDelegate 4 | 5 | @synthesize window; 6 | 7 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 8 | { 9 | // Insert code here to initialize your application 10 | } 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /samples/Pascal/program.dpr: -------------------------------------------------------------------------------- 1 | program gmail; 2 | 3 | uses 4 | Forms, 5 | Unit2 in 'Unit2.pas' {Form2}; 6 | 7 | {$R *.res} 8 | 9 | begin 10 | Application.Initialize; 11 | Application.MainFormOnTaskbar := True; 12 | Application.CreateForm(TForm2, Form2); 13 | Application.Run; 14 | end. 15 | -------------------------------------------------------------------------------- /samples/JavaScript/js2.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var http = require('http'); 3 | http.createServer(function (req, res) { 4 | res.writeHead(200, {'Content-Type': 'text/plain'}); 5 | res.end('Hello World\n'); 6 | }).listen(1337, '127.0.0.1'); 7 | console.log('Server running at http://127.0.0.1:1337/'); 8 | -------------------------------------------------------------------------------- /samples/SuperCollider/WarpPreset.sc: -------------------------------------------------------------------------------- 1 | WarpPreset { 2 | *new {|path| 3 | if(path.notNil) { 4 | ^Object.readArchive(path); 5 | }; 6 | 7 | ^super.new.init(); 8 | } 9 | 10 | init { 11 | 12 | } 13 | 14 | save { 15 | Dialog.savePanel({|path| 16 | this.writeArchive(path); 17 | }); 18 | } 19 | } -------------------------------------------------------------------------------- /samples/Swift/section-53.swift: -------------------------------------------------------------------------------- 1 | class NamedShape { 2 | var numberOfSides: Int = 0 3 | var name: String 4 | 5 | init(name: String) { 6 | self.name = name 7 | } 8 | 9 | func simpleDescription() -> String { 10 | return "A shape with \(numberOfSides) sides." 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/Visual Basic/Module1.vb: -------------------------------------------------------------------------------- 1 | Module Module1 2 | 3 | Sub Main() 4 | Console.Out.WriteLine("Hello, I am a little sample application to test GitHub's Linguist module.") 5 | Console.Out.WriteLine("I also include a Razor MVC file just to prove it handles cshtml files now.") 6 | End Sub 7 | 8 | End Module 9 | -------------------------------------------------------------------------------- /script/vendor-deb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | mkdir -p vendor/apt vendor/debs 8 | 9 | (cd vendor/apt && apt-get --assume-yes download "$@") 10 | 11 | for deb in vendor/apt/*.deb; do 12 | ar p $deb data.tar.gz | tar -vzxC vendor/debs --strip-components=2 13 | done 14 | -------------------------------------------------------------------------------- /samples/Graph Modeling Language/sample.gml: -------------------------------------------------------------------------------- 1 | graph 2 | [ 3 | directed 0 4 | node 5 | [ 6 | id 0 7 | label "Node 1" 8 | value 100 9 | ] 10 | node 11 | [ 12 | id 1 13 | label "Node 2" 14 | value 200 15 | ] 16 | edge 17 | [ 18 | source 1 19 | target 0 20 | ] 21 | ] 22 | -------------------------------------------------------------------------------- /samples/XML/libsomething.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/Logtalk/foo.lgt: -------------------------------------------------------------------------------- 1 | % this is a Logtalk source file 2 | 3 | :- object(hello_world). 4 | 5 | % the initialization/1 directive argument is automatically executed 6 | % when the object is loaded into memory: 7 | :- initialization((nl, write('********** Hello World! **********'), nl)). 8 | 9 | :- end_object. 10 | -------------------------------------------------------------------------------- /samples/CMake/filenames/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(Foo) 4 | 5 | set(CMAKE_SKIP_RPATH TRUE) 6 | set(CMAKE_INSTALL_PREFIX "/usr/local") 7 | 8 | add_subdirectory(bar) 9 | 10 | add_executable(foo foo.c) 11 | target_link_libraries(foo pthread) 12 | install(TARGETS foo DESTINATION bin) 13 | -------------------------------------------------------------------------------- /samples/Clojure/protocol.cljs: -------------------------------------------------------------------------------- 1 | (defprotocol ISound (sound [])) 2 | 3 | (deftype Cat [] 4 | ISound 5 | (sound [_] "Meow!")) 6 | 7 | (deftype Dog [] 8 | ISound 9 | (sound [_] "Woof!")) 10 | 11 | (extend-type default 12 | ISound 13 | (sound [_] "... silence ...")) 14 | 15 | (sound 1) ;; => "... silence ..." 16 | -------------------------------------------------------------------------------- /samples/Groovy Server Pages/bar.gsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Testing with SiteMesh and Resources 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/Xojo/MyToolbar.xojo_toolbar: -------------------------------------------------------------------------------- 1 | #tag Toolbar 2 | Begin Toolbar MyToolbar 3 | Begin ToolButton FirstItem 4 | Caption = "First Item" 5 | HelpTag = "" 6 | Style = 0 7 | End 8 | Begin ToolButton SecondItem 9 | Caption = "Second Item" 10 | HelpTag = "" 11 | Style = 0 12 | End 13 | End 14 | #tag EndToolbar 15 | -------------------------------------------------------------------------------- /samples/KRL/helloworld.krl: -------------------------------------------------------------------------------- 1 | ruleset sample { 2 | meta { 3 | name "Hello World" 4 | description << 5 | Hello world 6 | >> 7 | author "Phil Windley" 8 | } 9 | 10 | // just one rule 11 | rule hello { 12 | select when web pageview 13 | notify("Hello world!", "Just a note to say hello"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/Mathematica/Problem12.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | (* Problem12.m *) 4 | (* Author: William Woodruff *) 5 | (* Problem: What is the value of the first triangle number to have over five hundred divisors? *) 6 | 7 | Do[If[Length[Divisors[Binomial[i + 1, 2]]] > 500, 8 | Print[Binomial[i + 1, 2]]; Break[]], {i, 1000000}] 9 | -------------------------------------------------------------------------------- /samples/M/functions.m: -------------------------------------------------------------------------------- 1 | ; This function computes a factorial 2 | 3 | 4 | factorial(n) ;; 5 | new f 6 | set f=n 7 | for do quit:n'>1 8 | . set n=n-1 9 | . set f=f*n 10 | . write n," : ",f,! 11 | quit f 12 | 13 | 14 | 15 | main() ;; 16 | set x=5 17 | set y=$$factorial(x) 18 | write "Factorial of ",x," = ",y,! 19 | quit 20 | -------------------------------------------------------------------------------- /samples/Makefile/filenames/Makefile: -------------------------------------------------------------------------------- 1 | all: hello 2 | 3 | hello: main.o factorial.o hello.o 4 | g++ main.o factorial.o hello.o -o hello 5 | 6 | main.o: main.cpp 7 | g++ -c main.cpp 8 | 9 | factorial.o: factorial.cpp 10 | g++ -c factorial.cpp 11 | 12 | hello.o: hello.cpp 13 | g++ -c hello.cpp 14 | 15 | clean: 16 | rm -rf *o hello 17 | -------------------------------------------------------------------------------- /samples/Pascal/tw27294.pp: -------------------------------------------------------------------------------- 1 | uses 2 | uw27294; 3 | 4 | var 5 | p : procedure; 6 | 7 | procedure test; 8 | 9 | begin 10 | p:=@test; 11 | writeln('OK'); 12 | end; 13 | 14 | procedure global; 15 | begin 16 | p:=nil; 17 | test; 18 | p(); 19 | end; 20 | 21 | begin 22 | global; 23 | uw27294.global; 24 | end. 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/Prolog/test-prolog.prolog: -------------------------------------------------------------------------------- 1 | -/* Prolog test file */ 2 | -male(john). 3 | -male(peter). 4 | - 5 | -female(vick). 6 | -female(christie). 7 | - 8 | -parents(john, peter, christie). 9 | -parents(vick, peter, christie). 10 | - 11 | -/* X is a brother of Y */ 12 | -brother(X, Y) :- male(X), parents(X, F, M), parents(Y, F, M). 13 | -------------------------------------------------------------------------------- /samples/Cirru/scope.cirru: -------------------------------------------------------------------------------- 1 | 2 | set a (int 2) 3 | 4 | print (self) 5 | 6 | set c (child) 7 | 8 | under c 9 | under parent 10 | print a 11 | 12 | print $ get c a 13 | 14 | set c x (int 3) 15 | print $ get c x 16 | 17 | set just-print $ code 18 | print a 19 | 20 | print just-print 21 | 22 | eval (self) just-print 23 | eval just-print -------------------------------------------------------------------------------- /samples/Matlab/average.m: -------------------------------------------------------------------------------- 1 | function y = average(x) 2 | % AVERAGE Mean of vector elements. 3 | % AVERAGE(X), where X is a vector, is the mean of vector 4 | % elements. Nonvector input results in an error. 5 | [m,n] = size(x); 6 | if (~((m == 1) | (n == 1)) | (m == 1 & n == 1)) 7 | error('Input must be a vector') 8 | end 9 | y = sum(x)/length(x); 10 | -------------------------------------------------------------------------------- /samples/Pascal/large.pp: -------------------------------------------------------------------------------- 1 | program large; 2 | 3 | const 4 | max = 100000000; 5 | 6 | type 7 | tlist = array[1..max] of longint; 8 | 9 | var 10 | data : tlist; 11 | i : integer; 12 | 13 | begin 14 | 15 | i := 0; 16 | while(i < max) 17 | do 18 | begin 19 | data[i] := 0; 20 | Writeln(data[i]) 21 | end 22 | end. 23 | -------------------------------------------------------------------------------- /samples/Mercury/hello.m: -------------------------------------------------------------------------------- 1 | % "Hello World" in Mercury. 2 | 3 | % This source file is hereby placed in the public domain. -fjh (the author). 4 | 5 | :- module hello. 6 | :- interface. 7 | :- import_module io. 8 | 9 | :- pred main(io::di, io::uo) is det. 10 | 11 | :- implementation. 12 | 13 | main(!IO) :- 14 | io.write_string("Hello, world\n", !IO). 15 | -------------------------------------------------------------------------------- /samples/M/forloop.m: -------------------------------------------------------------------------------- 1 | start1 ; entry label 2 | set a=1 3 | set b=20 4 | set c=2 5 | set sum=0 6 | for i=a:c do quit:'(i String { 5 | return "The \(rank.simpleDescription()) of \(suit.simpleDescription())" 6 | } 7 | } 8 | let threeOfSpades = Card(rank: .Three, suit: .Spades) 9 | let threeOfSpadesDescription = threeOfSpades.simpleDescription() 10 | -------------------------------------------------------------------------------- /samples/Clean/stack.dcl: -------------------------------------------------------------------------------- 1 | definition module stack 2 | 3 | :: Stack a 4 | 5 | newStack :: (Stack a) 6 | push :: a (Stack a) -> Stack a 7 | pushes :: [a] (Stack a) -> Stack a 8 | pop :: (Stack a) -> Stack a 9 | popn :: Int (Stack a) -> Stack a 10 | top :: (Stack a) -> a 11 | topn :: Int (Stack a) -> [a] 12 | elements :: (Stack a) -> [a] 13 | count :: (Stack a) -> Int 14 | 15 | -------------------------------------------------------------------------------- /samples/Clean/streams.dcl: -------------------------------------------------------------------------------- 1 | definition module streams 2 | 3 | import StdEnv 4 | 5 | instance zero [Real] 6 | instance one [Real] 7 | instance + [Real] 8 | instance - [Real] 9 | instance * [Real] 10 | instance / [Real] 11 | 12 | X :: [Real] 13 | invert :: [Real] -> [Real] 14 | pow :: [Real] Int -> [Real] 15 | (shuffle) infixl 7 :: [Real] [Real] -> [Real] 16 | 17 | -------------------------------------------------------------------------------- /samples/Forth/bitmap.frt: -------------------------------------------------------------------------------- 1 | \ Bit arrays. 2 | : bits ( u1 -- u2 ) 7 + 3 rshift ; 3 | : bitmap ( u "name" -- ) create bits here over erase allot 4 | does> ( u -- a x ) over 3 rshift + 1 rot 7 and lshift ; 5 | : bit@ ( a x -- f ) swap c@ and ; 6 | : 1bit ( a x -- ) over c@ or swap c! ; 7 | : 0bit ( a x -- ) invert over c@ and swap c! ; 8 | : bit! ( f a x -- ) rot if 1bit else 0bit then ; 9 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoods.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | interface LexFoods = open Syntax in { 4 | oper 5 | wine_N : N ; 6 | pizza_N : N ; 7 | cheese_N : N ; 8 | fish_N : N ; 9 | fresh_A : A ; 10 | warm_A : A ; 11 | italian_A : A ; 12 | expensive_A : A ; 13 | delicious_A : A ; 14 | boring_A : A ; 15 | } 16 | -------------------------------------------------------------------------------- /samples/Dogescript/example.djs: -------------------------------------------------------------------------------- 1 | quiet 2 | wow 3 | such language 4 | very syntax 5 | github recognized wow 6 | loud 7 | 8 | such language much friendly 9 | rly friendly is true 10 | plz console.loge with 'such friend, very inclusive' 11 | but 12 | plz console.loge with 'no love for doge' 13 | wow 14 | wow 15 | 16 | module.exports is language -------------------------------------------------------------------------------- /samples/Smalltalk/testSimpleChainMatches.st: -------------------------------------------------------------------------------- 1 | tests 2 | testSimpleChainMatches 3 | |e eCtrl | 4 | e := self eventKey: $e. 5 | eCtrl := self eventKey: $e ctrl: true. 6 | 7 | self assert: (($e ctrl, $e) matches: {eCtrl}). 8 | self assert: ($e ctrl matches: {eCtrl. e}). 9 | 10 | self deny: (($e ctrl, $e) matches: {eCtrl. self eventKey: $a}). 11 | self deny: ($e ctrl matches: {e}). -------------------------------------------------------------------------------- /samples/Clean/GenHylo.dcl: -------------------------------------------------------------------------------- 1 | definition module GenHylo 2 | 3 | import StdGeneric, GenMap 4 | 5 | :: Fix f = In (f .(Fix f)) 6 | Out :: !u:(Fix v:a) -> v:(a w:(Fix v:a)), [u <= w] 7 | 8 | hylo :: ((.f .b) -> .b) (.a -> (.f .a)) -> (.a -> .b) | gMap{|*->*|} f 9 | cata :: (u:(f .a) -> .a) -> (Fix u:f) -> .a | gMap{|*->*|} f 10 | ana :: (.a -> u:(f .a)) -> .a -> (Fix u:f) | gMap{|*->*|} f 11 | 12 | -------------------------------------------------------------------------------- /samples/Clojure/into-array.cljc: -------------------------------------------------------------------------------- 1 | (defn into-array 2 | ([aseq] 3 | (into-array nil aseq)) 4 | ([type aseq] 5 | (let [n (count aseq) 6 | a (make-array n)] 7 | (loop [aseq (seq aseq) 8 | i 0] 9 | (if (< i n) 10 | (do 11 | (aset a i (first aseq)) 12 | (recur (next aseq) (inc i))) 13 | a))))) 14 | -------------------------------------------------------------------------------- /samples/JSONiq/detail.jq: -------------------------------------------------------------------------------- 1 | (: Query for returning one database entry :) 2 | 3 | import module namespace req = "http://www.28msec.com/modules/http-request"; 4 | import module namespace catalog = "http://guide.com/catalog"; 5 | 6 | variable $id := (req:param-values("id"), "London")[1]; 7 | variable $part := (req:param-values("part"), "main")[1]; 8 | 9 | catalog:get-data-by-key($id, $part) 10 | -------------------------------------------------------------------------------- /samples/Puppet/stages-example.pp: -------------------------------------------------------------------------------- 1 | class foo { 2 | notify { 3 | "foo": ; 4 | } 5 | } 6 | 7 | class bar { 8 | notify { 9 | "bar": ; 10 | } 11 | } 12 | 13 | 14 | node default { 15 | stage { 16 | "one": ; 17 | "two": ; 18 | } 19 | 20 | class { 21 | "foo": stage => "one"; 22 | "bar": stage => "two"; 23 | } 24 | 25 | Stage["one"] -> Stage["two"] 26 | } 27 | -------------------------------------------------------------------------------- /samples/Swift/section-25.swift: -------------------------------------------------------------------------------- 1 | let interestingNumbers = [ 2 | "Prime": [2, 3, 5, 7, 11, 13], 3 | "Fibonacci": [1, 1, 2, 3, 5, 8], 4 | "Square": [1, 4, 9, 16, 25], 5 | ] 6 | var largest = 0 7 | for (kind, numbers) in interestingNumbers { 8 | for number in numbers { 9 | if number > largest { 10 | largest = number 11 | } 12 | } 13 | } 14 | largest 15 | -------------------------------------------------------------------------------- /samples/Swift/section-41.swift: -------------------------------------------------------------------------------- 1 | func hasAnyMatches(list: Int[], condition: Int -> Bool) -> Bool { 2 | for item in list { 3 | if condition(item) { 4 | return true 5 | } 6 | } 7 | return false 8 | } 9 | func lessThanTen(number: Int) -> Bool { 10 | return number < 10 11 | } 12 | var numbers = [20, 19, 7, 12] 13 | hasAnyMatches(numbers, lessThanTen) 14 | -------------------------------------------------------------------------------- /samples/Matlab/matlab_script.m: -------------------------------------------------------------------------------- 1 | % Matlab example script 2 | 3 | %Call matlab_function function which resides in the same directory 4 | 5 | value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line. 6 | value2 = 3 7 | 8 | % Calculate sum of value1 and value2 9 | result = matlab_function(value1,value2); 10 | 11 | disp('called from script') 12 | disp(result); 13 | -------------------------------------------------------------------------------- /samples/Public Key/id.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQConqV+vS0WfY9swk8St+JcRuhft0jTg4IrAEfmxahSLurkbf54jbe8mrNn96Nm2gkRzs2RNVQ9r4dZzdhKTUk395Vs3LbX3cfdRNaCrs3udqhRZK7Go69DQECnEHFNczBxSrhT5DoO4nuzVimHgSsX7rHKHo6J7SDNowf83/nLUr7SAJvOeQo5yZQqqZQi5NXqH6pEOQtWPILdbZWuhq8s4JIXc38I+w3IXEJ0ttsfkyShv85bhwSFzrOlq2oGY37YVWeXPREXg9ksA6rlxe29SIdAQbINlgJ/ELzDVMYiaQkI5opAvI2EzPVd4325PcMgyFM/weO9F6bKZaGCNyt3 2 | -------------------------------------------------------------------------------- /samples/XProc/xproc.xpl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | Hello world! 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/AGS Script/KeyboardMovement_102.ash: -------------------------------------------------------------------------------- 1 | // Script header for module 'KeyboardMovement' 2 | 3 | #define KeyboardMovement_VERSION 101 4 | 5 | enum KeyboardMovement_Modes { 6 | eKeyboardMovement_None, 7 | eKeyboardMovement_Tapping, 8 | eKeyboardMovement_Pressing 9 | }; 10 | 11 | struct KeyboardMovement { 12 | import static function SetMode(KeyboardMovement_Modes mode); 13 | }; 14 | -------------------------------------------------------------------------------- /samples/BlitzMax/sample.bmx: -------------------------------------------------------------------------------- 1 | SuperStrict 2 | 3 | Framework Brl.StandardIO 4 | 5 | Type TMyType 6 | Field property:int 7 | 8 | Function A:int(param:int) 9 | 'do nothing 10 | End Function 11 | 12 | Method B:int(param:int) 13 | 'do nothing 14 | End Method 15 | End Type 16 | 17 | 18 | Global my:TMyType = new TMyType 19 | ?Win32 20 | my.A() 21 | my.B() 22 | ?Linux 23 | my.B() 24 | my.A() 25 | ? -------------------------------------------------------------------------------- /samples/Inform 7/story.ni: -------------------------------------------------------------------------------- 1 | "Test Case" by Andrew Plotkin. 2 | 3 | Include Trivial Extension by Andrew Plotkin. 4 | 5 | The Kitchen is a room. 6 | 7 | [This kitchen is modelled after the one in Zork, although it lacks the detail to establish this to the player.] 8 | 9 | A purple cow called Gelett is in the Kitchen. 10 | 11 | Instead of examining Gelett: 12 | say "You'd rather see than be one." 13 | -------------------------------------------------------------------------------- /lib/linguist/grammars.rb: -------------------------------------------------------------------------------- 1 | # Note: This file is included in the github-linguist-grammars gem, not the 2 | # github-linguist gem. 3 | 4 | module Linguist 5 | module Grammars 6 | # Get the path to the directory containing the language grammar JSON files. 7 | # 8 | # Returns a String. 9 | def self.path 10 | File.expand_path("../../../grammars", __FILE__) 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /samples/JavaScript/jsbuild.jsb: -------------------------------------------------------------------------------- 1 | jsb.library('mylibrary', jsb.STATIC_LIBRARY, function(libObject) { 2 | libObject.outputName = 'mylibrary'; 3 | libObject.cflags = [ '-Wall' ]; 4 | libObject.ldflags = [ '-pthread' ]; 5 | libObject.includePaths = [ 'src/include' ]; 6 | libObject.sources = [ 7 | 'src/main.cpp', 8 | 'src/app.cpp' 9 | ]; 10 | }); 11 | 12 | jsb.build(); 13 | -------------------------------------------------------------------------------- /samples/IGOR Pro/generic.ipf: -------------------------------------------------------------------------------- 1 | #pragma rtGlobals=3 2 | 3 | StrConstant myConstString="abcd" 4 | // some comment 5 | constant myConst=123 6 | 7 | Structure struct1 8 | string str 9 | variable var 10 | EndStructure 11 | 12 | static Structure struct2 13 | string str 14 | variable var 15 | EndStructure 16 | 17 | #include "someFile" 18 | 19 | #ifdef NOT_DEFINED 20 | // conditional compilation 21 | #endif 22 | -------------------------------------------------------------------------------- /samples/Matlab/distance.m: -------------------------------------------------------------------------------- 1 | function [ value,isterminal,direction ] = distance( t,y,mu ) 2 | % DISTANCE compute the distance from the attactors 3 | % [ value,terminal,direction ] = distance( t,y ) 4 | 5 | d=1e-2; % FIXME 6 | 7 | % TODO mettere if se tolleranza D-d value=0 8 | D=sqrt((y(1)+mu).^2+y(2).^2); % distance from the largest primary 9 | 10 | value=d-D; 11 | isterminal=1; 12 | direction=0; 13 | end -------------------------------------------------------------------------------- /samples/SAS/data.sas: -------------------------------------------------------------------------------- 1 | /* Example DATA step code for linguist */ 2 | 3 | libname source 'C:\path\to\file' 4 | 5 | data work.working_copy; 6 | set source.original_file.sas7bdat; 7 | run; 8 | 9 | data work.working_copy; 10 | set work.working_copy; 11 | if Purge = 1 then delete; 12 | run; 13 | 14 | data work.working_copy; 15 | set work.working_copy; 16 | if ImportantVariable = . then MissingFlag = 1; 17 | run; -------------------------------------------------------------------------------- /test/test_file_blob.rb: -------------------------------------------------------------------------------- 1 | require_relative "./helper" 2 | 3 | class TestFileBlob < Minitest::Test 4 | def test_extensions 5 | assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions 6 | assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions 7 | assert_equal [".html.erb", ".erb"], Linguist::FileBlob.new("dotted.dir/index.html.erb").extensions 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /samples/Ceylon/Foo.ceylon: -------------------------------------------------------------------------------- 1 | "Test function for Ceylon" 2 | by ("Enrique") 3 | shared void test() { 4 | print("test"); 5 | } 6 | 7 | "Test class for Ceylon" 8 | shared class Test(name) satisfies Comparable { 9 | shared String name; 10 | shared actual String string = "Test ``name``."; 11 | 12 | shared actual Comparison compare(Test other) { 13 | return name<=>other.name; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/OpenCL/sample.cl: -------------------------------------------------------------------------------- 1 | /* Old-style comment. */ 2 | 3 | // New-style comment. 4 | 5 | typedef float foo_t; 6 | 7 | #ifndef ZERO 8 | #define ZERO (0.0) 9 | #endif 10 | 11 | #define FOO(x) ((x) + \ 12 | ZERO) 13 | 14 | __kernel 15 | void foo(__global const foo_t * x, __local foo_t y, const uint n) 16 | { 17 | barrier(CLK_LOCAL_MEM_FENCE); 18 | 19 | if (n > 42) { 20 | *x += y; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /samples/Scilab/scilab_function.sci: -------------------------------------------------------------------------------- 1 | // A comment with whites and tabulations 2 | // Email: 3 | // Scilab editor: http://www.scilab.org/ 4 | function [a, b] = myfunction(d, e, f) 5 | a = 2.71828 + %pi + f($, :); 6 | b = cos(a) + cosh(a); 7 | if d == e then 8 | b = 10 - e.field; 9 | else 10 | b = " test " + home 11 | return 12 | end 13 | myvar = 1.23e-45; 14 | endfunction 15 | -------------------------------------------------------------------------------- /samples/Turtle/rdf-syntax-grammar.ttl: -------------------------------------------------------------------------------- 1 | @prefix rdf: . 2 | @prefix dc: . 3 | @prefix ex: . 4 | 5 | 6 | dc:title "RDF/XML Syntax Specification (Revised)" ; 7 | ex:editor [ 8 | ex:fullname "Dave Beckett"; 9 | ex:homePage 10 | ] . -------------------------------------------------------------------------------- /samples/CMake/sample1.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | enable_testing() 4 | 5 | set(CMAKE_BUILD_TYPE debug) 6 | 7 | include_directories("/usr/local/include") 8 | 9 | find_library(ssl_LIBRARY NAMES ssl PATHS "/usr/local/lib") 10 | 11 | add_custom_command(OUTPUT "ver.c" "ver.h" COMMAND ./ver.sh) 12 | 13 | add_executable(foo foo.c bar.c baz.c ver.c) 14 | 15 | target_link_libraries(foo ${ssl_LIBRARY}) 16 | -------------------------------------------------------------------------------- /samples/Ruby/rabl.rabl: -------------------------------------------------------------------------------- 1 | object @user => :person 2 | 3 | attributes :username, :email, :location 4 | attributes :created_at => :registered_at 5 | 6 | node :role do |user| 7 | user.is_admin ? 'admin' : 'normal' 8 | end 9 | 10 | child :phone_numbers => :pnumbers do 11 | extends "users/phone_number" 12 | end 13 | 14 | node :node_numbers do |u| 15 | partial("users/phone_number", :object => u.phone_numbers) 16 | end 17 | -------------------------------------------------------------------------------- /samples/BitBake/qtbase-native.bb: -------------------------------------------------------------------------------- 1 | require qt5-git.inc 2 | require ${PN}.inc 3 | 4 | do_install_append() { 5 | # for modules which are still using syncqt and call qtPrepareTool(QMAKE_SYNCQT, syncqt) 6 | # e.g. qt3d, qtwayland 7 | ln -sf syncqt.pl ${D}${OE_QMAKE_PATH_QT_BINS}/syncqt 8 | } 9 | 10 | QT_MODULE_BRANCH = "release" 11 | # v5.2.1 + 168 commits 12 | SRCREV = "08cbbde61778276ccdda73d89fd64d02c623779f" 13 | 14 | -------------------------------------------------------------------------------- /samples/AsciiDoc/encoding.asciidoc: -------------------------------------------------------------------------------- 1 | Gregory Romé has written an AsciiDoc plugin for the Redmine project management application. 2 | 3 | https://github.com/foo-users/foo 4 | へと `vicmd` キーマップを足してみている試み、 5 | アニメーションgifです。 6 | 7 | tag::romé[] 8 | Gregory Romé has written an AsciiDoc plugin for the Redmine project management application. 9 | end::romé[] 10 | 11 | == Überschrift 12 | 13 | * Codierungen sind verrückt auf älteren Versionen von Ruby -------------------------------------------------------------------------------- /samples/Dart/point.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | class Point { 4 | num x, y; 5 | 6 | Point(this.x, this.y); 7 | 8 | num distanceTo(Point other) { 9 | var dx = x - other.x; 10 | var dy = y - other.y; 11 | return math.sqrt(dx * dx + dy * dy); 12 | } 13 | } 14 | 15 | void main() { 16 | var p = new Point(2, 3); 17 | var q = new Point(3, 4); 18 | print('distance from p to q = ${p.distanceTo(q)}'); 19 | } 20 | -------------------------------------------------------------------------------- /samples/XML/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | tests 7 | 8 | 9 | 10 | 11 | src 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/Hack/startup.hh: -------------------------------------------------------------------------------- 1 | (lhs: T, rhs: U) -> Bool { 2 | for lhsItem in lhs { 3 | for rhsItem in rhs { 4 | if lhsItem == rhsItem { 5 | return true 6 | } 7 | } 8 | } 9 | return false 10 | } 11 | anyCommonElements([1, 2, 3], [3]) 12 | -------------------------------------------------------------------------------- /samples/Hack/index.hh: -------------------------------------------------------------------------------- 1 | 4 | :idprefix: id_ 5 | 6 | Preamble paragraph. 7 | 8 | NOTE: This is test, only a test. 9 | 10 | == Section A 11 | 12 | *Section A* paragraph. 13 | 14 | === Section A Subsection 15 | 16 | *Section A* 'subsection' paragraph. 17 | 18 | == Section B 19 | 20 | *Section B* paragraph. 21 | 22 | .Section B list 23 | * Item 1 24 | * Item 2 25 | * Item 3 26 | -------------------------------------------------------------------------------- /samples/Logos/example.xm: -------------------------------------------------------------------------------- 1 | %hook ABC 2 | - (id)a:(B)b { 3 | %log; 4 | return %orig(nil); 5 | } 6 | %end 7 | 8 | %subclass DEF: NSObject 9 | - (id)init { 10 | [%c(RuntimeAccessibleClass) alloc]; 11 | return nil; 12 | } 13 | %end 14 | 15 | %group OptionalHooks 16 | %hook ABC 17 | - (void)release { 18 | [self retain]; 19 | %orig; 20 | } 21 | %end 22 | %end 23 | 24 | %ctor { 25 | %init; 26 | if(OptionalCondition) 27 | %init(OptionalHooks); 28 | } 29 | -------------------------------------------------------------------------------- /samples/Omgrofl/hello.omgrofl: -------------------------------------------------------------------------------- 1 | lol iz 71 2 | wtf lol iz liek 71 3 | lmao lol 4 | brb 5 | w00t Hello, World! 6 | rofl lol 7 | lol iz 101 8 | rofl lol 9 | lol iz 108 10 | rofl lol 11 | rofl lol 12 | lool iz 111 13 | rofl lool 14 | loool iz 44 15 | rofl loool 16 | loool iz 32 17 | rofl loool 18 | loool iz 87 19 | rofl loool 20 | rofl lool 21 | lool iz 114 22 | rofl lool 23 | rofl lol 24 | lol iz 100 25 | rofl lol 26 | lol iz 33 27 | rofl lol 28 | stfu 29 | -------------------------------------------------------------------------------- /samples/Shell/php.fcgi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # you can change the PHP version here. 3 | version="RB_PHP_VERSION_X_Y_Z" 4 | 5 | # php.ini file location 6 | PHPRC=/usr/local/php/phpfarm/inst/php-${version}/lib/php.ini 7 | export PHPRC 8 | 9 | PHP_FCGI_CHILDREN=3 10 | export PHP_FCGI_CHILDREN 11 | 12 | PHP_FCGI_MAX_REQUESTS=5000 13 | export PHP_FCGI_MAX_REQUESTS 14 | 15 | # which php-cgi binary to execute 16 | exec /usr/local/php/inst/php-${version}/bin/php-cgi 17 | -------------------------------------------------------------------------------- /samples/Matlab/Lagrangian_points.m: -------------------------------------------------------------------------------- 1 | % Plot dei Lagrangian points 2 | n=5; 3 | mu=linspace(0,0.5,n); 4 | for i=1:n 5 | [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu(i)); 6 | figure (1) 7 | hold all 8 | plot(xl1, yl1, 's') 9 | plot(xl2, yl2, 's') 10 | plot(xl3, yl3, 's') 11 | plot(xl4, yl4, 's') 12 | plot(xl5, yl5, 's') 13 | plot(-mu,0,'o') 14 | plot(1-mu,0, 'o') 15 | plot([-mu(i) xl4],[0 yl4]) 16 | end -------------------------------------------------------------------------------- /samples/Common Lisp/sample.lisp: -------------------------------------------------------------------------------- 1 | ;;;; -*- lisp -*- 2 | 3 | (in-package :foo) 4 | 5 | ;;; Header comment. 6 | (defvar *foo*) 7 | 8 | (eval-when (:execute :compile-toplevel :load-toplevel) 9 | (defun add (x &optional y &key z) 10 | (declare (ignore z)) 11 | ;; Inline comment. 12 | (+ x (or y 1)))) 13 | 14 | #| 15 | Multi-line comment. 16 | |# 17 | 18 | (defmacro foo (x &body b) 19 | (if x 20 | `(1+ ,x) ;After-line comment. 21 | 42)) 22 | -------------------------------------------------------------------------------- /samples/Common Lisp/sample.lsp: -------------------------------------------------------------------------------- 1 | ;;;; -*- lisp -*- 2 | 3 | (in-package :foo) 4 | 5 | ;;; Header comment. 6 | (defvar *foo*) 7 | 8 | (eval-when (:execute :compile-toplevel :load-toplevel) 9 | (defun add (x &optional y &key z) 10 | (declare (ignore z)) 11 | ;; Inline comment. 12 | (+ x (or y 1)))) 13 | 14 | #| 15 | Multi-line comment. 16 | |# 17 | 18 | (defmacro foo (x &body b) 19 | (if x 20 | `(1+ ,x) ;After-line comment. 21 | 42)) 22 | -------------------------------------------------------------------------------- /samples/Matlab/test_rk_par.m: -------------------------------------------------------------------------------- 1 | clear 2 | mu=0.1; 3 | x_0=linspace(-0.8, -0.15, 2) 4 | y_0=zeros(1,2) 5 | vx_0=linspace(-2, 2, 2) 6 | vy_0=zeros(1,2) 7 | ci=[1-mu-0.05 0 0.005 0.5290] 8 | t0=[0;0] 9 | T=[2;2] 10 | tspan=2 11 | arg1={@f;@f} 12 | %tspan={[0 2],[0 2]}; 13 | arg=[mu;mu] 14 | [X]=arrayfun(RK4_par,t0,T,x_0',y_0',vx_0',vy_0',arg) 15 | % [X]=arrayfun(@f,[0;1],[ci;ci],[mu;mu]); 16 | %Y=RK4(@f,tspan,ci,mu); 17 | % figure 18 | % plot(Y(:,1),Y(:,2)) 19 | % Y(end,1) -------------------------------------------------------------------------------- /samples/Perl6/grammar-test.p6: -------------------------------------------------------------------------------- 1 | token pod_formatting_code { 2 | $=<[A..Z]> 3 | '<' { $*POD_IN_FORMATTINGCODE := 1 } 4 | $=[ '> ]+ 5 | '>' { $*POD_IN_FORMATTINGCODE := 0 } 6 | } 7 | 8 | token pod_string { 9 | + 10 | } 11 | 12 | token something:sym«<» { 13 | 14 | } 15 | 16 | token name { 17 | 18 | } 19 | 20 | token comment:sym<#> { 21 | '#' {} \N* 22 | } 23 | -------------------------------------------------------------------------------- /samples/STON/TestDomainObject.ston: -------------------------------------------------------------------------------- 1 | TestDomainObject { 2 | #created : DateAndTime [ '2012-02-14T16:40:15+01:00' ], 3 | #modified : DateAndTime [ '2012-02-14T16:40:18+01:00' ], 4 | #integer : 39581, 5 | #float : 73.84789359463944, 6 | #description : 'This is a test', 7 | #color : #green, 8 | #tags : [ 9 | #two, 10 | #beta, 11 | #medium 12 | ], 13 | #bytes : ByteArray [ 'afabfdf61d030f43eb67960c0ae9f39f' ], 14 | #boolean : false 15 | } 16 | -------------------------------------------------------------------------------- /samples/Mathematica/PacletInfo.m: -------------------------------------------------------------------------------- 1 | (* Paclet Info File *) 2 | 3 | (* created 2014/02/07*) 4 | 5 | Paclet[ 6 | Name -> "Foobar", 7 | Version -> "0.0.1", 8 | MathematicaVersion -> "8+", 9 | Description -> "Example of an automatically generated PacletInfo file.", 10 | Creator -> "Chris Granade", 11 | Extensions -> 12 | { 13 | {"Documentation", Language -> "English", MainPage -> "Guides/Foobar"} 14 | } 15 | ] 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/Matlab/matlab_script2.m: -------------------------------------------------------------------------------- 1 | % Matlab example script 2 2 | % Comments precended with arbitrary whitespace (spaces or tabs) 3 | 4 | %Call matlab_function function which resides in the same directory 5 | 6 | value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line. 7 | value2 = 3 8 | 9 | % Calculate sum of value1 and value2 10 | result = matlab_function(value1,value2); 11 | 12 | disp('called from script') 13 | disp(result); -------------------------------------------------------------------------------- /samples/FORTRAN/sample1.f: -------------------------------------------------------------------------------- 1 | c comment 2 | * comment 3 | 4 | program main 5 | 6 | end 7 | 8 | subroutine foo( i, x, b ) 9 | INTEGER i 10 | REAL x 11 | LOGICAL b 12 | 13 | if( i.ne.0 ) then 14 | call bar( -i ) 15 | end if 16 | 17 | return 18 | end 19 | 20 | double complex function baz() 21 | 22 | baz = (0.0d0,0.0d0) 23 | 24 | return 25 | end 26 | -------------------------------------------------------------------------------- /samples/FORTRAN/sample1.for: -------------------------------------------------------------------------------- 1 | c comment 2 | * comment 3 | 4 | program main 5 | 6 | end 7 | 8 | subroutine foo( i, x, b ) 9 | INTEGER i 10 | REAL x 11 | LOGICAL b 12 | 13 | if( i.ne.0 ) then 14 | call bar( -i ) 15 | end if 16 | 17 | return 18 | end 19 | 20 | double complex function baz() 21 | 22 | baz = (0.0d0,0.0d0) 23 | 24 | return 25 | end 26 | -------------------------------------------------------------------------------- /samples/FORTRAN/sample2.f: -------------------------------------------------------------------------------- 1 | PROGRAM MAIN 2 | 3 | END 4 | 5 | C comment 6 | * comment 7 | 8 | SUBROUTINE foo( i, x, b ) 9 | INTEGER i 10 | REAL x 11 | LOGICAL b 12 | 13 | IF( i.NE.0 ) THEN 14 | CALL bar( -i ) 15 | END IF 16 | 17 | RETURN 18 | END 19 | 20 | DOUBLE COMPLEX FUNCTION baz() 21 | 22 | baz = (0.0d0,0.0d0) 23 | 24 | RETURN 25 | END 26 | -------------------------------------------------------------------------------- /samples/FORTRAN/sample3.F: -------------------------------------------------------------------------------- 1 | c comment 2 | * comment 3 | 4 | program main 5 | 6 | end 7 | 8 | subroutine foo( i, x, b ) 9 | INTEGER i 10 | REAL x 11 | LOGICAL b 12 | 13 | if( i.ne.0 ) then 14 | call bar( -i ) 15 | end if 16 | 17 | return 18 | end 19 | 20 | double complex function baz() 21 | 22 | baz = (0.0d0,0.0d0) 23 | 24 | return 25 | end 26 | -------------------------------------------------------------------------------- /samples/CoffeeScript/classes.coffee: -------------------------------------------------------------------------------- 1 | class Animal 2 | constructor: (@name) -> 3 | 4 | move: (meters) -> 5 | alert @name + " moved " + meters + "m." 6 | 7 | class Snake extends Animal 8 | move: -> 9 | alert "Slithering..." 10 | super 5 11 | 12 | class Horse extends Animal 13 | move: -> 14 | alert "Galloping..." 15 | super 45 16 | 17 | sam = new Snake "Sammy the Python" 18 | tom = new Horse "Tommy the Palomino" 19 | 20 | sam.move() 21 | tom.move() 22 | -------------------------------------------------------------------------------- /samples/OpenSCAD/not_simple.scad: -------------------------------------------------------------------------------- 1 | // A more complicated 3D shape in OpenSCAD 2 | $fn=32; 3 | 4 | difference() { 5 | // main shape 6 | union() { 7 | translate( [ 0, 0, 2 ] ) cube( [ 15, 15, 4 ], center=true ); 8 | translate( [ 0, 0, 13 ] ) cylinder( h=25, r1=5, r2=3, center=true ); 9 | translate( [ 0, 0, 28 ] ) sphere( r=6 ); 10 | } 11 | // hole through center 12 | translate( [ 0, 0, 17 ] ) cylinder( h=35, r=2, center=true ); 13 | } 14 | -------------------------------------------------------------------------------- /samples/SAS/proc.sas: -------------------------------------------------------------------------------- 1 | /* PROC examples for Linguist */ 2 | 3 | proc surveyselect data=work.data out=work.boot method=urs reps=20000 seed=2156 sampsize=28 outhits; 4 | samplingunit Site; 5 | run; 6 | 7 | PROC MI data=work.boot out=work.bootmi nimpute=30 seed=5686 round = 1; 8 | By Replicate; 9 | VAR Variable1 Variable2; 10 | run; 11 | 12 | proc logistic data=work.bootmi descending; 13 | By Replicate _Imputation_; 14 | model Outcome = Variable1 Variable2 / risklimits; 15 | run; -------------------------------------------------------------------------------- /samples/Shell/build.command: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | echo "/************/" 4 | echo "/* BUILDING */" 5 | echo "/************/" 6 | echo "" 7 | 8 | cd `dirname $0` 9 | 10 | cd build 11 | 12 | cmake .. 13 | 14 | make 15 | 16 | echo "" 17 | echo "/***********/" 18 | echo "/* TESTING */" 19 | echo "/***********/" 20 | echo "" 21 | 22 | # ctest .. 23 | 24 | make Experimental 25 | 26 | echo "" 27 | echo "/***********/" 28 | echo "/* SUCCESS */" 29 | echo "/***********/" 30 | echo "" 31 | -------------------------------------------------------------------------------- /samples/STON/properties.ston: -------------------------------------------------------------------------------- 1 | { 2 | "category" : "Topez-Server-Core", 3 | "classinstvars" : [ 4 | ], 5 | "classvars" : [ 6 | ], 7 | "commentStamp" : "", 8 | "instvars" : [ 9 | "workingCopy", 10 | "repository", 11 | "versionInfos", 12 | "versionInfoBlock", 13 | "selectedVersionInfo", 14 | "versionInfoSummaryWindowId" ], 15 | "name" : "TDVersionInfoBrowser", 16 | "pools" : [ 17 | ], 18 | "super" : "TDAbstractMonticelloToolBuilder", 19 | "type" : "normal" } 20 | -------------------------------------------------------------------------------- /samples/Turing/turing.t: -------------------------------------------------------------------------------- 1 | % Accepts a number and calculates its factorial 2 | 3 | function factorial (n: int) : real 4 | if n = 0 then 5 | result 1 6 | else 7 | result n * factorial (n - 1) 8 | end if 9 | end factorial 10 | 11 | var n: int 12 | loop 13 | put "Please input an integer: " .. 14 | get n 15 | exit when n >= 0 16 | put "Input must be a non-negative integer." 17 | end loop 18 | 19 | put "The factorial of ", n, " is ", factorial (n) 20 | -------------------------------------------------------------------------------- /lib/linguist/popular.yml: -------------------------------------------------------------------------------- 1 | # Popular languages appear at the top of language dropdowns 2 | # 3 | # This file should only be edited by GitHub staff 4 | 5 | - ActionScript 6 | - C 7 | - C# 8 | - C++ 9 | - CSS 10 | - Clojure 11 | - CoffeeScript 12 | - Common Lisp 13 | - Diff 14 | - Emacs Lisp 15 | - Erlang 16 | - HTML 17 | - Haskell 18 | - Java 19 | - JavaScript 20 | - Lua 21 | - Objective-C 22 | - PHP 23 | - Perl 24 | - Python 25 | - Ruby 26 | - SQL 27 | - Scala 28 | - Scheme 29 | - Shell 30 | -------------------------------------------------------------------------------- /samples/Groovy Server Pages/hello-pagedirective.gsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" %> 2 | 3 | 4 | 5 | Using page directive tag 6 | 7 | 8 |
9 | Download 10 |
11 |
12 | Print 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/Stata/regress_example.do: -------------------------------------------------------------------------------- 1 | * Setup 2 | sysuse auto 3 | 4 | * Fit a linear regression 5 | regress mpg weight foreign 6 | 7 | * Fit a better linear regression, from a physics standpoint 8 | gen gp100m = 100/mpg 9 | regress gp100m weight foreign 10 | 11 | * Obtain beta coefficients without refitting model 12 | regress, beta 13 | 14 | * Suppress intercept term 15 | regress weight length, noconstant 16 | 17 | * Model already has constant 18 | regress weight length bn.foreign, hascons 19 | -------------------------------------------------------------------------------- /samples/SystemVerilog/priority_encoder.sv: -------------------------------------------------------------------------------- 1 | // http://hdlsnippets.com/parameterized_priority_encoder 2 | module priority_encoder #(parameter INPUT_WIDTH=8,OUTPUT_WIDTH=3) 3 | ( 4 | input logic [INPUT_WIDTH-1:0] input_data, 5 | output logic [OUTPUT_WIDTH-1:0] output_data 6 | ); 7 | 8 | int ii; 9 | 10 | always_comb 11 | begin 12 | output_data = 'b0; 13 | for(ii=0;ii $params) {} 14 | } 15 | 16 | -------------------------------------------------------------------------------- /samples/Matlab/Poincare.m: -------------------------------------------------------------------------------- 1 | clear 2 | %% Initial Conditions 3 | mu=0.012277471; 4 | T=10; 5 | N=5; 6 | C=3.17; 7 | x_0=0.30910452642073; 8 | y_0=0.07738174525518; 9 | vx_0=-0.72560796964234; 10 | vy_0=sqrt(-C-vx_0^2+2*Potential(x_0,y_0,mu)); 11 | k=0; 12 | %% Integration 13 | options=odeset('AbsTol',1e-22,'RelTol',1e-13,'Events',@cross_y); 14 | [t,y,te,ye,ie]=ode113(@f,[0 T],[x_0; y_0; vx_0; vy_0],options,mu); 15 | 16 | figure 17 | %plot(ye(:,1),ye(:,3),'rs') 18 | plot(ye(:,1),0,'rs') -------------------------------------------------------------------------------- /samples/Swift/section-23.swift: -------------------------------------------------------------------------------- 1 | let vegetable = "red pepper" 2 | switch vegetable { 3 | case "celery": 4 | let vegetableComment = "Add some raisins and make ants on a log." 5 | case "cucumber", "watercress": 6 | let vegetableComment = "That would make a good tea sandwich." 7 | case let x where x.hasSuffix("pepper"): 8 | let vegetableComment = "Is it a spicy \(x)?" 9 | default: 10 | let vegetableComment = "Everything tastes good in soup." 11 | } 12 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/Foods.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | abstract Foods = { 4 | flags startcat = Comment ; 5 | cat 6 | Comment ; Item ; Kind ; Quality ; 7 | fun 8 | Pred : Item -> Quality -> Comment ; 9 | This, That, These, Those : Kind -> Item ; 10 | Mod : Quality -> Kind -> Kind ; 11 | Wine, Cheese, Fish, Pizza : Kind ; 12 | Very : Quality -> Quality ; 13 | Fresh, Warm, Italian, 14 | Expensive, Delicious, Boring : Quality ; 15 | } 16 | -------------------------------------------------------------------------------- /samples/Swift/section-73.swift: -------------------------------------------------------------------------------- 1 | enum ServerResponse { 2 | case Result(String, String) 3 | case Error(String) 4 | } 5 | 6 | let success = ServerResponse.Result("6:00 am", "8:09 pm") 7 | let failure = ServerResponse.Error("Out of cheese.") 8 | 9 | switch success { 10 | case let .Result(sunrise, sunset): 11 | let serverResponse = "Sunrise is at \(sunrise) and sunset is at \(sunset)." 12 | case let .Error(error): 13 | let serverResponse = "Failure... \(error)" 14 | } 15 | -------------------------------------------------------------------------------- /samples/Matlab/ieee.m: -------------------------------------------------------------------------------- 1 | % This script loads in the data used for the IEEE paper and creates the plots. 2 | clc; close all; 3 | 4 | bikes = {'Benchmark', 'Browserins', 'Browser', 'Pista', ... 5 | 'Fisher', 'Yellow', 'Yellowrev'}; 6 | 7 | data = load_bikes(bikes, 'Steer'); 8 | 9 | rollData = generate_data('Benchmark', 5.0, ... 10 | 'input', 'Roll', ... 11 | 'gains', [1, 55, 3.76, 0.413, 0.076]); 12 | 13 | create_ieee_paper_plots(data, rollData) 14 | -------------------------------------------------------------------------------- /github-linguist-grammars.gemspec: -------------------------------------------------------------------------------- 1 | require File.expand_path('../lib/linguist/version', __FILE__) 2 | 3 | Gem::Specification.new do |s| 4 | s.name = 'github-linguist-grammars' 5 | s.version = Linguist::VERSION 6 | s.summary = "Language grammars for use with github-linguist" 7 | 8 | s.authors = "GitHub" 9 | s.homepage = "https://github.com/github/linguist" 10 | 11 | s.files = ['lib/linguist/grammars.rb'] + Dir['grammars/*'] 12 | 13 | s.add_development_dependency 'plist', '~>3.1' 14 | end 15 | -------------------------------------------------------------------------------- /samples/YAML/vcr_cassette.yml: -------------------------------------------------------------------------------- 1 | --- 2 | http_interactions: 3 | - request: 4 | method: get 5 | uri: http://example.com/ 6 | body: '' 7 | headers: {} 8 | response: 9 | status: 10 | code: 200 11 | message: OK 12 | headers: 13 | Content-Type: 14 | - text/html;charset=utf-8 15 | Content-Length: 16 | - '26' 17 | body: This is the response body 18 | http_version: '1.1' 19 | recorded_at: Tue, 01 Nov 2011 04:58:44 GMT 20 | recorded_with: VCR 2.0.0 21 | -------------------------------------------------------------------------------- /samples/E/IO.E: -------------------------------------------------------------------------------- 1 | # E sample from 2 | # http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/InputOutput 3 | #File objects for hardwired files: 4 | def file1 := 5 | def file2 := 6 | 7 | #Using a variable for a file name: 8 | def filePath := "c:\\docs\\myFile.txt" 9 | def file3 := [filePath] 10 | 11 | #Using a single character to specify a Windows drive 12 | def file4 := 13 | def file5 := 14 | def file6 := 15 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoodsIta.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | instance LexFoodsIta of LexFoods = 4 | open SyntaxIta, ParadigmsIta in { 5 | oper 6 | wine_N = mkN "vino" ; 7 | pizza_N = mkN "pizza" ; 8 | cheese_N = mkN "formaggio" ; 9 | fish_N = mkN "pesce" ; 10 | fresh_A = mkA "fresco" ; 11 | warm_A = mkA "caldo" ; 12 | italian_A = mkA "italiano" ; 13 | expensive_A = mkA "caro" ; 14 | delicious_A = mkA "delizioso" ; 15 | boring_A = mkA "noioso" ; 16 | } 17 | -------------------------------------------------------------------------------- /samples/Erlang/factorial.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env escript 2 | %% -*- erlang -*- 3 | %%! -smp enable -sname factorial -mnesia debug verbose 4 | main([String]) -> 5 | try 6 | N = list_to_integer(String), 7 | F = fac(N), 8 | io:format("factorial ~w = ~w\n", [N,F]) 9 | catch 10 | _:_ -> 11 | usage() 12 | end; 13 | main(_) -> 14 | usage(). 15 | 16 | usage() -> 17 | io:format("usage: factorial integer\n"), 18 | halt(1). 19 | 20 | fac(0) -> 1; 21 | fac(N) -> N * fac(N-1). 22 | -------------------------------------------------------------------------------- /samples/PHP/filenames/.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 35 | -------------------------------------------------------------------------------- /samples/Opal/DeepakChopra.opal: -------------------------------------------------------------------------------- 1 | -- Deepak Chopra nonsense text generator 2 | -- see https://github.com/StoneCypher/DeepakChopra_Opal/ 3 | 4 | starts = ["Experiential truth ", "The physical world ", "Non-judgment ", "Quantum physics "] 5 | middles = ["nurtures an ", "projects onto ", "imparts reality to ", "constructs with "] 6 | qualifiers = ["abundance of ", "the barrier of ", "self-righteous ", "potential "] 7 | finishes = ["marvel.", "choices.", "creativity.", "actions."] 8 | 9 | alert starts.sample + middles.sample + qualifiers.sample + finishes.sample -------------------------------------------------------------------------------- /samples/Swift/section-69.swift: -------------------------------------------------------------------------------- 1 | enum Suit { 2 | case Spades, Hearts, Diamonds, Clubs 3 | func simpleDescription() -> String { 4 | switch self { 5 | case .Spades: 6 | return "spades" 7 | case .Hearts: 8 | return "hearts" 9 | case .Diamonds: 10 | return "diamonds" 11 | case .Clubs: 12 | return "clubs" 13 | } 14 | } 15 | } 16 | let hearts = Suit.Hearts 17 | let heartsDescription = hearts.simpleDescription() 18 | -------------------------------------------------------------------------------- /samples/Perl/oo1.pl: -------------------------------------------------------------------------------- 1 | #! perl 2 | 3 | # Copyright (C) 2004-2006, Parrot Foundation. 4 | 5 | use strict; 6 | use warnings; 7 | 8 | for my $i ( 1 .. 100000 ) { 9 | my $o = new Foo(); 10 | } 11 | my $o = new Foo(); 12 | print $o->[0], "\n"; 13 | 14 | package Foo; 15 | 16 | sub new { 17 | my $self = ref $_[0] ? ref shift : shift; 18 | return bless [ 10, 20 ], $self; 19 | } 20 | 1; 21 | 22 | # Local Variables: 23 | # mode: cperl 24 | # cperl-indent-level: 4 25 | # fill-column: 100 26 | # End: 27 | # vim: expandtab shiftwidth=4: 28 | -------------------------------------------------------------------------------- /samples/Perl/oo2.pl: -------------------------------------------------------------------------------- 1 | #! perl 2 | 3 | # Copyright (C) 2004-2006, Parrot Foundation. 4 | 5 | use strict; 6 | use warnings; 7 | 8 | for my $i ( 1 .. 500000 ) { 9 | my $o = new Foo(); 10 | } 11 | my $o = new Foo(); 12 | print $o->[0], "\n"; 13 | 14 | package Foo; 15 | 16 | sub new { 17 | my $self = ref $_[0] ? ref shift : shift; 18 | return bless [ 10, 20 ], $self; 19 | } 20 | 1; 21 | 22 | # Local Variables: 23 | # mode: cperl 24 | # cperl-indent-level: 4 25 | # fill-column: 100 26 | # End: 27 | # vim: expandtab shiftwidth=4: 28 | -------------------------------------------------------------------------------- /samples/desktop/example.desktop: -------------------------------------------------------------------------------- 1 | # http://standards.freedesktop.org/desktop-entry-spec/latest/apa.html 2 | 3 | [Desktop Entry] 4 | Version=1.0 5 | Type=Application 6 | Name=Foo Viewer 7 | Comment=The best viewer for Foo objects available! 8 | TryExec=fooview 9 | Exec=fooview %F 10 | Icon=fooview 11 | MimeType=image/x-foo; 12 | Actions=Gallery;Create; 13 | 14 | [Desktop Action Gallery] 15 | Exec=fooview --gallery 16 | Name=Browse Gallery 17 | 18 | [Desktop Action Create] 19 | Exec=fooview --create-new 20 | Name=Create a new Foo! 21 | Icon=fooview-new -------------------------------------------------------------------------------- /samples/Clojure/for.clj: -------------------------------------------------------------------------------- 1 | (defn prime? [n] 2 | (not-any? zero? (map #(rem n %) (range 2 n)))) 3 | 4 | (range 3 33 2) 5 | '(3 5 7 9 11 13 15 17 19 21 23 25 27 29 31) 6 | 7 | ;; :when continues through the collection even if some have the 8 | ;; condition evaluate to false, like filter 9 | (for [x (range 3 33 2) :when (prime? x)] 10 | x) 11 | '(3 5 7 11 13 17 19 23 29 31) 12 | 13 | ;; :while stops at the first collection element that evaluates to 14 | ;; false, like take-while 15 | (for [x (range 3 33 2) :while (prime? x)] 16 | x) 17 | '(3 5 7) 18 | -------------------------------------------------------------------------------- /samples/Hack/MySecureRequest.hh: -------------------------------------------------------------------------------- 1 | $GETParams) {} 7 | public function stringParam(string $name): UNESCAPED_STRING { 8 | invariant($this->GETParams->contains($name), 'Unknown GET param: '.$name); 9 | $raw_string = $this->GETParams[$name]; 10 | invariant(is_string($raw_string), $name.' is not a string'); 11 | return unescaped_string($raw_string); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/ColdFusion CFC/exampleTag.cfc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/Gradle/builder.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: GreetingPlugin 2 | 3 | greeting { 4 | message = 'Hi' 5 | greeter = 'Gradle' 6 | } 7 | 8 | class GreetingPlugin implements Plugin { 9 | void apply(Project project) { 10 | project.extensions.create("greeting", GreetingPluginExtension) 11 | project.task('hello') << { 12 | println "${project.greeting.message} from ${project.greeting.greeter}" 13 | } 14 | } 15 | } 16 | 17 | class GreetingPluginExtension { 18 | String message 19 | String greeter 20 | } 21 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoodsSwe.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | instance LexFoodsSwe of LexFoods = 4 | open SyntaxSwe, ParadigmsSwe in { 5 | flags coding=utf8; 6 | oper 7 | wine_N = mkN "vin" "vinet" "viner" "vinerna" ; 8 | pizza_N = mkN "pizza" ; 9 | cheese_N = mkN "ost" ; 10 | fish_N = mkN "fisk" ; 11 | fresh_A = mkA "färsk" ; 12 | warm_A = mkA "varm" ; 13 | italian_A = mkA "italiensk" ; 14 | expensive_A = mkA "dyr" ; 15 | delicious_A = mkA "läcker" ; 16 | boring_A = mkA "tråkig" ; 17 | } 18 | -------------------------------------------------------------------------------- /samples/Moocode/toy.moo: -------------------------------------------------------------------------------- 1 | @verb toy:do_the_work this none this 2 | @program toy:do_the_work 3 | if (this.wound) 4 | if ($object_utils:isa(this.location,$room)) 5 | this.location:announce_all(this.name," ", this:continue_msg()); 6 | this.wound = this.wound - 1; 7 | if (this.wound) 8 | fork (15) 9 | this:do_the_work(); 10 | endfork 11 | else 12 | this.location:announce_all(this.name, " ", this:wind_down_msg()); 13 | endif 14 | endif 15 | if (this.wound < 0) 16 | this.wound = 0; 17 | endif 18 | endif 19 | . 20 | -------------------------------------------------------------------------------- /samples/Xojo/BillingReport.xojo_report: -------------------------------------------------------------------------------- 1 | #tag Report 2 | Begin Report BillingReport 3 | Compatibility = "" 4 | Units = 0 5 | Width = 8.5 6 | Begin PageHeader 7 | Type = 1 8 | Height = 1.0 9 | End 10 | Begin Body 11 | Type = 3 12 | Height = 2.0 13 | End 14 | Begin PageFooter 15 | Type = 5 16 | Height = 1.0 17 | End 18 | End 19 | #tag EndReport 20 | 21 | #tag ReportCode 22 | #tag EndReportCode 23 | 24 | -------------------------------------------------------------------------------- /samples/Clojure/unit-test.cl2: -------------------------------------------------------------------------------- 1 | (deftest function-tests 2 | (is (= 3 3 | (count [1 2 3]))) 4 | (is (= false 5 | (not true))) 6 | (is (= true 7 | (contains? {:foo 1 :bar 2} :foo))) 8 | 9 | (is (= {"foo" 1, "baz" 3} 10 | (select-keys {:foo 1 :bar 2 :baz 3} [:foo :baz]))) 11 | 12 | (is (= [1 2 3] 13 | (vals {:foo 1 :bar 2 :baz 3}))) 14 | 15 | (is (= ["foo" "bar" "baz"] 16 | (keys {:foo 1 :bar 2 :baz 3}))) 17 | 18 | (is (= [2 4 6] 19 | (filter (fn [x] (=== (rem x 2) 0)) [1 2 3 4 5 6])))) 20 | 21 | -------------------------------------------------------------------------------- /samples/CoffeeScript/intro.coffee: -------------------------------------------------------------------------------- 1 | # Assignment: 2 | number = 42 3 | opposite = true 4 | 5 | # Conditions: 6 | number = -42 if opposite 7 | 8 | # Functions: 9 | square = (x) -> x * x 10 | 11 | # Arrays: 12 | list = [1, 2, 3, 4, 5] 13 | 14 | # Objects: 15 | math = 16 | root: Math.sqrt 17 | square: square 18 | cube: (x) -> x * square x 19 | 20 | # Splats: 21 | race = (winner, runners...) -> 22 | print winner, runners 23 | 24 | # Existence: 25 | alert "I knew it!" if elvis? 26 | 27 | # Array comprehensions: 28 | cubes = (math.cube num for num in list) 29 | -------------------------------------------------------------------------------- /samples/Hack/RecipeWithDemo.hh: -------------------------------------------------------------------------------- 1 | [0]; 11 | my $y = $o->[1]; 12 | } 13 | print $o->[0], "\n"; 14 | 15 | package Foo; 16 | 17 | sub new { 18 | my $self = ref $_[0] ? ref shift : shift; 19 | return bless [ 10, 20 ], $self; 20 | } 21 | 22 | 1; 23 | 24 | # Local Variables: 25 | # mode: cperl 26 | # cperl-indent-level: 4 27 | # fill-column: 100 28 | # End: 29 | # vim: expandtab shiftwidth=4: 30 | -------------------------------------------------------------------------------- /samples/SQL/AvailableInSearchSel.prc: -------------------------------------------------------------------------------- 1 | IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = OBJECT_ID(N'dbo.AvailableInSearchSel') AND OBJECTPROPERTY(id, N'IsProcedure') = 1) 2 | DROP PROCEDURE dbo.AvailableInSearchSel 3 | GO 4 | CREATE Procedure AvailableInSearchSel 5 | AS 6 | 7 | SELECT '-1', 8 | 'Select...' 9 | UNION ALL 10 | SELECT '1', 11 | 'Yes' 12 | UNION ALL 13 | SELECT '0', 14 | 'No' 15 | GO 16 | IF DB_NAME() = 'Diebold' BEGIN 17 | GRANT EXECUTE ON dbo.AvailableInSearchSel TO [rv] 18 | END 19 | GO 20 | -------------------------------------------------------------------------------- /samples/C#/BsonPropertyValue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MongoDB.Serialization.Descriptors 4 | { 5 | internal class BsonPropertyValue 6 | { 7 | public bool IsDictionary { get; private set; } 8 | 9 | public Type Type { get; private set; } 10 | 11 | public object Value { get; private set; } 12 | 13 | public BsonPropertyValue(Type type, object value, bool isDictionary) 14 | { 15 | Type = type; 16 | Value = value; 17 | IsDictionary = isDictionary; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /samples/JSON/person.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName": "John", 3 | "lastName" : "Smith", 4 | "age" : 25, 5 | "address" : 6 | { 7 | "streetAddress": "21 2nd Street", 8 | "city" : "New York", 9 | "state" : "NY", 10 | "postalCode" : "10021" 11 | }, 12 | "phoneNumber": 13 | [ 14 | { 15 | "type" : "home", 16 | "number": "212 555-1234" 17 | }, 18 | { 19 | "type" : "fax", 20 | "number": "646 555-4567" 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /samples/Xojo/database.xojo_script: -------------------------------------------------------------------------------- 1 | Dim dbFile As FolderItem 2 | Dim db As New SQLiteDatabase 3 | dbFile = GetFolderItem("Employees.sqlite") 4 | db.DatabaseFile = dbFile 5 | If db.Connect Then 6 | db.SQLExecute("BEGIN TRANSACTION") 7 | db.SQLExecute ("INSERT INTO Employees (Name,Job,YearJoined) VALUES "_ 8 | +"('Dr.Strangelove','Advisor',1962)") 9 | If db.Error then 10 | MsgBox("Error: " + db.ErrorMessage) 11 | db.Rollback 12 | Else 13 | db.Commit 14 | End If 15 | Else 16 | MsgBox("The database couldn't be opened. Error: " + db.ErrorMessage) 17 | End If 18 | -------------------------------------------------------------------------------- /samples/HTML/example.xht: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This is a XHTML sample file 5 | 10 | 11 | 12 |
13 | Just a simple XHTML test page. 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /samples/Matlab/RK4.m: -------------------------------------------------------------------------------- 1 | function x = RK4( fun, tspan, ci, mu ) 2 | %RK4 4th-order Runge Kutta integrator 3 | % Detailed explanation goes here 4 | h=1e-5; 5 | t=tspan(1); 6 | T=tspan(length(tspan)); 7 | dim=length(ci); 8 | %x=zeros(l,dim); 9 | x(:,1)=ci; 10 | i=1; 11 | while t " }, 16 | proc { " | " }] 17 | 18 | # Disable pry-buggy-plug: 19 | Pry.plugins["buggy-plug"].disable! 20 | -------------------------------------------------------------------------------- /samples/Gradle/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: GreetingPlugin 2 | 3 | greeting.message = 'Hi from Gradle' 4 | 5 | class GreetingPlugin implements Plugin { 6 | void apply(Project project) { 7 | // Add the 'greeting' extension object 8 | project.extensions.create("greeting", GreetingPluginExtension) 9 | // Add a task that uses the configuration 10 | project.task('hello') << { 11 | println project.greeting.message 12 | } 13 | } 14 | } 15 | 16 | class GreetingPluginExtension { 17 | def String message = 'Hello from GreetingPlugin' 18 | } 19 | -------------------------------------------------------------------------------- /samples/Swift/section-55.swift: -------------------------------------------------------------------------------- 1 | class Square: NamedShape { 2 | var sideLength: Double 3 | 4 | init(sideLength: Double, name: String) { 5 | self.sideLength = sideLength 6 | super.init(name: name) 7 | numberOfSides = 4 8 | } 9 | 10 | func area() -> Double { 11 | return sideLength * sideLength 12 | } 13 | 14 | override func simpleDescription() -> String { 15 | return "A square with sides of length \(sideLength)." 16 | } 17 | } 18 | let test = Square(sideLength: 5.2, name: "my test square") 19 | test.area() 20 | test.simpleDescription() 21 | -------------------------------------------------------------------------------- /test/helper.rb: -------------------------------------------------------------------------------- 1 | require "bundler/setup" 2 | require "minitest/autorun" 3 | require "mocha/setup" 4 | require "linguist" 5 | 6 | def fixtures_path 7 | File.expand_path("../fixtures", __FILE__) 8 | end 9 | 10 | def fixture_blob(name) 11 | name = File.join(fixtures_path, name) unless name =~ /^\// 12 | Linguist::FileBlob.new(name, fixtures_path) 13 | end 14 | 15 | def samples_path 16 | File.expand_path("../../samples", __FILE__) 17 | end 18 | 19 | def sample_blob(name) 20 | name = File.join(samples_path, name) unless name =~ /^\// 21 | Linguist::FileBlob.new(name, samples_path) 22 | end 23 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoodsGer.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | instance LexFoodsGer of LexFoods = 4 | open SyntaxGer, ParadigmsGer in { 5 | flags coding=utf8; 6 | oper 7 | wine_N = mkN "Wein" ; 8 | pizza_N = mkN "Pizza" "Pizzen" feminine ; 9 | cheese_N = mkN "Käse" "Käse" masculine ; 10 | fish_N = mkN "Fisch" ; 11 | fresh_A = mkA "frisch" ; 12 | warm_A = mkA "warm" "wärmer" "wärmste" ; 13 | italian_A = mkA "italienisch" ; 14 | expensive_A = mkA "teuer" ; 15 | delicious_A = mkA "köstlich" ; 16 | boring_A = mkA "langweilig" ; 17 | } 18 | -------------------------------------------------------------------------------- /samples/Lua/h-counter.pd_lua: -------------------------------------------------------------------------------- 1 | 2 | -- A simple counting object that increments an internal counter whenever it receives a bang at its first inlet, or changes to whatever number it receives at its second inlet. 3 | 4 | local HelloCounter = pd.Class:new():register("h-counter") 5 | 6 | function HelloCounter:initialize(sel, atoms) 7 | self.inlets = 2 8 | self.outlets = 1 9 | self.num = 0 10 | return true 11 | end 12 | 13 | function HelloCounter:in_1_bang() 14 | self:outlet(1, "float", {self.num}) 15 | self.num = self.num + 1 16 | end 17 | 18 | function HelloCounter:in_2_float(f) 19 | self.num = f 20 | end 21 | -------------------------------------------------------------------------------- /samples/Hack/UnescapedString.hh: -------------------------------------------------------------------------------- 1 | "%s" <--- Escaped', $s); 16 | } 17 | -------------------------------------------------------------------------------- /samples/XML/XmlIO.pluginspec: -------------------------------------------------------------------------------- 1 | 2 | FreeMedForms 3 | (C) 2008-2012 by Eric MAEKER, MD 4 | GPLv3 5 | Patient data 6 | The XML form loader/saver for FreeMedForms. 7 | http://www.freemedforms.com/ 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lib/linguist/documentation.yml: -------------------------------------------------------------------------------- 1 | # Documentation files and directories are excluded from language 2 | # statistics. 3 | # 4 | # Lines in this file are Regexps that are matched against the file 5 | # pathname. 6 | # 7 | # Please add additional test coverage to 8 | # `test/test_blob.rb#test_documentation` if you make any changes. 9 | 10 | ## Documentation directories ## 11 | 12 | - ^docs?/ 13 | - (^|/)[Dd]ocumentation/ 14 | - (^|/)javadoc/ 15 | - ^man/ 16 | 17 | ## Documentation files ## 18 | 19 | - (^|/)CONTRIBUTING(\.|$) 20 | - (^|/)COPYING(\.|$) 21 | - (^|/)INSTALL(\.|$) 22 | - (^|/)LICEN[CS]E(\.|$) 23 | - (^|/)README(\.|$) 24 | -------------------------------------------------------------------------------- /samples/JSONiq/query.jq: -------------------------------------------------------------------------------- 1 | (: Query for searching the database for keywords :) 2 | 3 | import module namespace index = "http://guide.com/index"; 4 | import module namespace catalog = "http://guide.com/catalog"; 5 | 6 | import module namespace req = "http://www.28msec.com/modules/http-request"; 7 | 8 | variable $phrase := (req:param-values("q"), "London")[1]; 9 | variable $limit := integer((req:param-values("limit"), 5)[1]); 10 | 11 | [ 12 | for $result at $idx in index:index-search($phrase) 13 | where $idx le $limit 14 | let $data := catalog:get-data-by-id($result.s, $result.p) 15 | return 16 | {| { score : $result.r } , $data |} 17 | ] 18 | -------------------------------------------------------------------------------- /samples/Protocol Buffer/addressbook.proto: -------------------------------------------------------------------------------- 1 | package tutorial; 2 | 3 | option java_package = "com.example.tutorial"; 4 | option java_outer_classname = "AddressBookProtos"; 5 | 6 | message Person { 7 | required string name = 1; 8 | required int32 id = 2; 9 | optional string email = 3; 10 | 11 | enum PhoneType { 12 | MOBILE = 0; 13 | HOME = 1; 14 | WORK = 2; 15 | } 16 | 17 | message PhoneNumber { 18 | required string number = 1; 19 | optional PhoneType type = 2 [default = HOME]; 20 | } 21 | 22 | repeated PhoneNumber phone = 4; 23 | } 24 | 25 | message AddressBook { 26 | repeated Person person = 1; 27 | } 28 | -------------------------------------------------------------------------------- /samples/C/Nightmare.h: -------------------------------------------------------------------------------- 1 | #ifndef _NMEX_NIGHTMARE_H 2 | #define _NMEX_NIGHTMARE_H 3 | 4 | //#define NMEX 5 | 6 | #include "../src/NCompat.h" 7 | 8 | START_HEAD 9 | 10 | #include "../src/NTypes.h" 11 | #include "../src/NUtil.h" 12 | #include "../src/NPorting.h" 13 | #include "../src/NGlobals.h" 14 | #include "../src/NLog.h" 15 | #include "../src/NWMan.h" 16 | #include "../src/NRsc.h" 17 | #include "../src/NShader.h" 18 | #include "../src/NSquare.h" 19 | #include "../src/NImage.h" 20 | #include "../src/NSprite.h" 21 | #include "../src/NSpritesheet.h" 22 | #include "../src/NEntity.h" 23 | #include "../src/Game.h" 24 | 25 | END_HEAD 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /samples/Swift/section-65.swift: -------------------------------------------------------------------------------- 1 | enum Rank: Int { 2 | case Ace = 1 3 | case Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten 4 | case Jack, Queen, King 5 | func simpleDescription() -> String { 6 | switch self { 7 | case .Ace: 8 | return "ace" 9 | case .Jack: 10 | return "jack" 11 | case .Queen: 12 | return "queen" 13 | case .King: 14 | return "king" 15 | default: 16 | return String(self.toRaw()) 17 | } 18 | } 19 | } 20 | let ace = Rank.Ace 21 | let aceRawValue = ace.toRaw() 22 | -------------------------------------------------------------------------------- /samples/C#/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace LittleSampleApp 8 | { 9 | /// 10 | /// Just what it says on the tin. A little sample application for Linguist to try out. 11 | /// 12 | /// 13 | class Program 14 | { 15 | static void Main(string[] args) 16 | { 17 | Console.WriteLine("Hello, I am a little sample application to test GitHub's Linguist module."); 18 | Console.WriteLine("I also include a Razor MVC file just to prove it handles cshtml files now."); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/Swift/section-77.swift: -------------------------------------------------------------------------------- 1 | class SimpleClass: ExampleProtocol { 2 | var simpleDescription: String = "A very simple class." 3 | var anotherProperty: Int = 69105 4 | func adjust() { 5 | simpleDescription += " Now 100% adjusted." 6 | } 7 | } 8 | var a = SimpleClass() 9 | a.adjust() 10 | let aDescription = a.simpleDescription 11 | 12 | struct SimpleStructure: ExampleProtocol { 13 | var simpleDescription: String = "A simple structure" 14 | mutating func adjust() { 15 | simpleDescription += " (adjusted)" 16 | } 17 | } 18 | var b = SimpleStructure() 19 | b.adjust() 20 | let bDescription = b.simpleDescription 21 | -------------------------------------------------------------------------------- /samples/Shell/99-bottles-of-beer.script!: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Bourne Again shell version of 99 Bottles 3 | # Dave Plonka - plonka@carroll1.cc.edu 4 | 5 | typeset -i n=99 6 | typeset bottles=bottles 7 | typeset no 8 | 9 | while [ 0 != $[ n ] ] 10 | do 11 | echo "${n?} ${bottles?} of beer on the wall," 12 | echo "${n?} ${bottles?} of beer," 13 | echo "take one down, pass it around," 14 | n=n-1 15 | case ${n?} in 16 | 0) 17 | no=no 18 | bottles=${bottles%s}s 19 | ;; 20 | 1) 21 | bottles=${bottles%s} 22 | ;; 23 | esac 24 | echo "${no:-${n}} ${bottles?} of beer on the wall." 25 | echo 26 | done 27 | 28 | exit 29 | -------------------------------------------------------------------------------- /samples/C/exception.zep.c: -------------------------------------------------------------------------------- 1 | 2 | #ifdef HAVE_CONFIG_H 3 | #include "../../ext_config.h" 4 | #endif 5 | 6 | #include 7 | #include "../../php_ext.h" 8 | #include "../../ext.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "kernel/main.h" 15 | 16 | 17 | /** 18 | * Test\Router\Exception 19 | * 20 | * Exceptions generated by the router 21 | */ 22 | ZEPHIR_INIT_CLASS(Test_Router_Exception) { 23 | 24 | ZEPHIR_REGISTER_CLASS_EX(Test\\Router, Exception, test, router_exception, zend_exception_get_default(TSRMLS_C), NULL, 0); 25 | 26 | return SUCCESS; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /samples/EmberScript/momentComponent.em: -------------------------------------------------------------------------------- 1 | class App.FromNowView extends Ember.View 2 | tagName: 'time' 3 | template: Ember.Handlebars.compile '{{view.output}}' 4 | output: ~> 5 | return moment(@value).fromNow() 6 | 7 | didInsertElement: -> 8 | @tick() 9 | 10 | tick: -> 11 | f = -> 12 | @notifyPropertyChange 'output' 13 | @tick() 14 | 15 | nextTick = Ember.run.later(this, f, 1000) 16 | @set 'nextTick', nextTick 17 | 18 | willDestroyElement: -> 19 | nextTick = @nextTick 20 | Ember.run.cancel nextTick 21 | 22 | Ember.Handlebars.helper 'fromNow', App.FromNowView 23 | 24 | -------------------------------------------------------------------------------- /samples/Groovy/build.script!: -------------------------------------------------------------------------------- 1 | task echoDirListViaAntBuilder() { 2 | description = 'Uses the built-in AntBuilder instance to echo and list files' 3 | //Docs: http://ant.apache.org/manual/Types/fileset.html 4 | 5 | //Echo the Gradle project name via the ant echo plugin 6 | ant.echo(message: project.name) 7 | ant.echo(path) 8 | ant.echo("${projectDir}/samples") 9 | 10 | //Gather list of files in a subdirectory 11 | ant.fileScanner{ 12 | fileset(dir:"samples") 13 | }.each{ 14 | //Print each file to screen with the CWD (projectDir) path removed. 15 | println it.toString() - "${projectDir}" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /samples/XSLT/test.xslt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

My CD Collection

9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
TitleArtist
21 | 22 | 23 |
24 | 25 |
26 | -------------------------------------------------------------------------------- /samples/APL/DeepakChopra.apl: -------------------------------------------------------------------------------- 1 | ⍝ You can try this at http://tryapl.org/ 2 | ⍝ I can not explain how much I suddenly love this crypto-language 3 | 4 | 5 | 6 | Starts ← 'Experiential truth ' 'The physical world ' 'Non-judgment ' 'Quantum physics ' 7 | Middles ← 'nurtures an ' 'projects onto ' 'imparts reality to ' 'constructs with ' 8 | Qualifiers ← 'abundance of ' 'the barrier of ' 'self-righteous ' 'potential ' 9 | Finishes ← 'marvel.' 'choices.' 'creativity.' 'actions.' 10 | 11 | rf ← {(?⍴⍵)⊃⍵} 12 | erf ← {rf ¨ ⍵} 13 | 14 | deepak ← {erf Starts Middles Qualifiers Finishes} 15 | 16 | 17 | 18 | deepak ⍬ -------------------------------------------------------------------------------- /samples/C/blob.c: -------------------------------------------------------------------------------- 1 | #include "cache.h" 2 | #include "blob.h" 3 | 4 | const char *blob_type = "blob"; 5 | 6 | struct blob *lookup_blob(const unsigned char *sha1) 7 | { 8 | struct object *obj = lookup_object(sha1); 9 | if (!obj) 10 | return create_object(sha1, OBJ_BLOB, alloc_blob_node()); 11 | if (!obj->type) 12 | obj->type = OBJ_BLOB; 13 | if (obj->type != OBJ_BLOB) { 14 | error("Object %s is a %s, not a blob", 15 | sha1_to_hex(sha1), typename(obj->type)); 16 | return NULL; 17 | } 18 | return (struct blob *) obj; 19 | } 20 | 21 | int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size) 22 | { 23 | item->object.parsed = 1; 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /samples/Racket/99-bottles-of-beer.scrbl: -------------------------------------------------------------------------------- 1 | ; Clean, simple and efficient code -- that's the power of Racket! 2 | ; http://racket-lang.org/ 3 | 4 | (define (bottles n more) 5 | (printf "~a bottle~a of beer~a" 6 | (case n [(0) "no more"] [(1) "1"] [else n]) 7 | (if (= n 1) "" "s") 8 | more)) 9 | 10 | (for ([n (in-range 99 0 -1)]) 11 | (bottles n " on the wall, ") 12 | (bottles n ".\n") 13 | (printf "Take one down and pass it around, ") 14 | (bottles (sub1 n) " on the wall.\n\n")) 15 | 16 | (displayln "No more bottles of beer on the wall, no more bottles of beer.") 17 | (displayln "Go to the store and buy some more, 99 bottles of beer on the wall.") 18 | -------------------------------------------------------------------------------- /samples/TypeScript/classes.ts: -------------------------------------------------------------------------------- 1 | class Animal { 2 | constructor(public name) { } 3 | move(meters) { 4 | alert(this.name + " moved " + meters + "m."); 5 | } 6 | } 7 | 8 | class Snake extends Animal { 9 | constructor(name) { super(name); } 10 | move() { 11 | alert("Slithering..."); 12 | super.move(5); 13 | } 14 | } 15 | 16 | class Horse extends Animal { 17 | constructor(name) { super(name); } 18 | move() { 19 | alert("Galloping..."); 20 | super.move(45); 21 | } 22 | } 23 | 24 | var sam = new Snake("Sammy the Python") 25 | var tom: Animal = new Horse("Tommy the Palomino") 26 | 27 | sam.move() 28 | tom.move(34) 29 | -------------------------------------------------------------------------------- /samples/Clean/GenMap.icl: -------------------------------------------------------------------------------- 1 | implementation module GenMap 2 | 3 | import StdClass, StdArray, StdInt, StdFunc 4 | import StdGeneric, _Array 5 | 6 | generic gMap a b :: .a -> .b 7 | gMap{|c|} x = x 8 | gMap{|UNIT|} x = x 9 | gMap{|PAIR|} fx fy (PAIR x y) = PAIR (fx x) (fy y) 10 | gMap{|EITHER|} fl fr (LEFT x) = LEFT (fl x) 11 | gMap{|EITHER|} fl fr (RIGHT x) = RIGHT (fr x) 12 | gMap{|CONS|} f (CONS x) = CONS (f x) 13 | gMap{|FIELD|} f (FIELD x) = FIELD (f x) 14 | gMap{|OBJECT|} f (OBJECT x) = OBJECT (f x) 15 | gMap{|{}|} f xs = mapArray f xs 16 | gMap{|{!}|} f xs = mapArray f xs 17 | 18 | derive gMap [], (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,) 19 | 20 | -------------------------------------------------------------------------------- /samples/SQL/filial.tab: -------------------------------------------------------------------------------- 1 | create table FILIAL 2 | ( 3 | id NUMBER not null, 4 | title_ua VARCHAR2(128) not null, 5 | title_ru VARCHAR2(128) not null, 6 | title_eng VARCHAR2(128) not null, 7 | remove_date DATE, 8 | modify_date DATE, 9 | modify_user VARCHAR2(128) 10 | ) 11 | ; 12 | alter table FILIAL 13 | add constraint PK_ID primary key (ID); 14 | grant select on FILIAL to ATOLL; 15 | grant select on FILIAL to CRAMER2GIS; 16 | grant select on FILIAL to DMS; 17 | grant select on FILIAL to HPSM2GIS; 18 | grant select on FILIAL to PLANMONITOR; 19 | grant select on FILIAL to SIEBEL; 20 | grant select on FILIAL to VBIS; 21 | grant select on FILIAL to VPORTAL; 22 | 23 | -------------------------------------------------------------------------------- /samples/JSON5/example.json5: -------------------------------------------------------------------------------- 1 | /* 2 | * The following is a contrived example, but it illustrates most of the features: 3 | */ 4 | 5 | { 6 | foo: 'bar', 7 | while: true, 8 | 9 | this: 'is a \ 10 | multi-line string', 11 | 12 | // this is an inline comment 13 | here: 'is another', // inline comment 14 | 15 | /* this is a block comment 16 | that continues on another line */ 17 | 18 | hex: 0xDEADbeef, 19 | half: .5, 20 | delta: +10, 21 | to: Infinity, // and beyond! 22 | 23 | finally: 'a trailing comma', 24 | oh: [ 25 | "we shouldn't forget", 26 | 'arrays can have', 27 | 'trailing commas too', 28 | ], 29 | } 30 | -------------------------------------------------------------------------------- /samples/QMake/complex.pro: -------------------------------------------------------------------------------- 1 | # This QMake file is complex, as it usese 2 | # boolean operators and function calls 3 | 4 | QT += core gui 5 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 6 | 7 | # We could use some OpenGL right now 8 | contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) { 9 | QT += opengl 10 | } else { 11 | DEFINES += QT_NO_OPENGL 12 | } 13 | 14 | TEMPLATE = app 15 | win32 { 16 | TARGET = BlahApp 17 | RC_FILE = Resources/winres.rc 18 | } 19 | !win32 { TARGET = blahapp } 20 | 21 | # Let's add a PRI file! 22 | include(functions.pri) 23 | 24 | SOURCES += file.cpp 25 | 26 | HEADERS += file.h 27 | 28 | FORMS += file.ui 29 | 30 | RESOURCES += res.qrc 31 | -------------------------------------------------------------------------------- /samples/GAP/factor.tst: -------------------------------------------------------------------------------- 1 | gap> START_TEST("Test of factor groups and natural homomorphisms"); 2 | 3 | gap> G:=HeisenbergPcpGroup(2); 4 | Pcp-group with orders [ 0, 0, 0, 0, 0 ] 5 | 6 | gap> H:=Subgroup(G,[G.2,G.3,G.4,G.5]); 7 | gap> K:=G/H; 8 | gap> NaturalHomomorphism(K); 9 | 10 | gap> A:=Subgroup(H, [G.3]); 11 | Pcp-group with orders [ 0 ] 12 | gap> B:=Subgroup(Subgroup(G,[G.1,G.4,G.5]), [G.4]); 13 | Pcp-group with orders [ 0 ] 14 | gap> Normalizer(A,B); 15 | Pcp-group with orders [ 0 ] 16 | gap> # The following used to trigger the error "arguments must have a common parent group" 17 | gap> Normalizer(B,A); 18 | Pcp-group with orders [ 0 ] 19 | 20 | 21 | gap> STOP_TEST( "factor.tst", 10000000); 22 | -------------------------------------------------------------------------------- /samples/IGOR Pro/functions.ipf: -------------------------------------------------------------------------------- 1 | #pragma rtGlobals=3 2 | 3 | Function FooBar() 4 | return 0 5 | End 6 | 7 | Function FooBarSubType() : ButtonControl 8 | return 0 9 | End 10 | 11 | Function/D FooBarVar() 12 | return 0 13 | End 14 | 15 | static Function FooBarStatic() 16 | return 0 17 | End 18 | 19 | threadsafe static Function FooBarStaticThreadsafe() 20 | return 0 21 | End 22 | 23 | threadsafe Function FooBarThread() 24 | return 0 25 | End 26 | 27 | Function CallOperationsAndBuiltInFuncs(string var) 28 | 29 | string someDQString = "abcd" 30 | 31 | Make/N=(1,2,3,4) myWave 32 | Redimension/N=(-1,-1,-1,5) myWave 33 | 34 | print strlen(someDQString) 35 | 36 | return 0 37 | End 38 | 39 | -------------------------------------------------------------------------------- /samples/Cool/list.cl: -------------------------------------------------------------------------------- 1 | (* This simple example of a list class is adapted from an example in the 2 | Cool distribution. *) 3 | 4 | class List { 5 | isNil() : Bool { true }; 6 | head() : Int { { abort(); 0; } }; 7 | tail() : List { { abort(); self; } }; 8 | cons(i : Int) : List { 9 | (new Cons).init(i, self) 10 | }; 11 | }; 12 | 13 | class Cons inherits List { 14 | car : Int; -- The element in this list cell 15 | cdr : List; -- The rest of the list 16 | isNil() : Bool { false }; 17 | head() : Int { car }; 18 | tail() : List { cdr }; 19 | init(i : Int, rest : List) : List { 20 | { 21 | car <- i; 22 | cdr <- rest; 23 | self; 24 | } 25 | }; 26 | }; 27 | -------------------------------------------------------------------------------- /samples/PHP/php2.script!: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 23 | -------------------------------------------------------------------------------- /samples/Public Key/sunCert.asc: -------------------------------------------------------------------------------- 1 | Type Bits/KeyID Date User ID 2 | pub 1024/79949ADD 2005/08/07 sun 3 | 4 | -----BEGIN PGP PUBLIC KEY BLOCK----- 5 | Version: 2.6.3i 6 | 7 | mQCNA0L2Km8AAAEEANRAVMn8HBxfYaGhLqtQ3IZJArn9wpcQ+7sH/F9PaXIjzHRQ 8 | rfFkfmxxp9lVjCk0LM/BnnlnUmyz6F8K7V0Gi40Am4+ln1zHvZZIQJYGrDhDnjb7 9 | I5TVeD4Ib5bQ1CoUbIhv2LocCeR6OjefQgGmerC5RQ3d5ci7uB0pVpd5lJrdAAUR 10 | tBhzdW4gPHN1bi5zdHJvbmdzd2FuLm9yZz6JAJUDBRBC9ipvHSlWl3mUmt0BAUZR 11 | A/43nuZbxADMSviu54Mj8pvQbYeGLQVabiWT6h7L0ZPX4MWpFH3dTixBfRrZRSsj 12 | 0AgiMMuZAMebfOe+Xf9uDQv7p1yumEiNg43tg85zyawkARWNTZZ04woxtvAqNwXn 13 | lQotGz7YA6JMxry9RQo5yI4Y4dPnVZ/o8eDpP0+I88cOhQ== 14 | =lLvB 15 | -----END PGP PUBLIC KEY BLOCK----- 16 | -------------------------------------------------------------------------------- /lib/linguist/strategy/filename.rb: -------------------------------------------------------------------------------- 1 | module Linguist 2 | module Strategy 3 | # Detects language based on filename and/or extension 4 | class Filename 5 | def self.call(blob, _) 6 | name = blob.name.to_s 7 | 8 | # A bit of an elegant hack. If the file is executable but extensionless, 9 | # append a "magic" extension so it can be classified with other 10 | # languages that have shebang scripts. 11 | extensions = FileBlob.new(name).extensions 12 | if extensions.empty? && blob.mode && (blob.mode.to_i(8) & 05) == 05 13 | name += ".script!" 14 | end 15 | 16 | Language.find_by_filename(name) 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /samples/XML/module.ant: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | This easyant module.ant sample file is optionnal and designed to customize your build with your own specific target. 5 | 6 | 7 | 8 | my awesome additionnal target 9 | 10 | 11 | 12 | i would love easyant i could easily plug my own specific pre compile step 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/E/Functions.E: -------------------------------------------------------------------------------- 1 | # from 2 | # http://wiki.erights.org/wiki/Walnut/Ordinary_Programming/Objects_and_Functions 3 | def makeCar(var name) { 4 | var x := 0 5 | var y := 0 6 | def car { 7 | to moveTo(newX,newY) { 8 | x := newX 9 | y := newY 10 | } 11 | to getX() {return x} 12 | to getY() {return y} 13 | to setName(newName) {name := newName} 14 | to getName() {return name} 15 | } 16 | return car 17 | } 18 | # Now use the makeCar function to make a car, which we will move and print 19 | def sportsCar := makeCar("Ferrari") 20 | sportsCar.moveTo(10,20) 21 | println(`The car ${sportsCar.getName()} is at X location ${sportsCar.getX()}`) 22 | -------------------------------------------------------------------------------- /samples/Zimpl/sample.zmpl: -------------------------------------------------------------------------------- 1 | # $Id: queens3.zpl,v 1.3 2009/09/13 16:15:53 bzfkocht Exp $ 2 | # 3 | # This is a formulation of the n queens problem using binary variables. 4 | # variables. Since the number of queens is maximized, the size of the 5 | # board can be set arbitrarily. 6 | # 7 | param columns := 8; 8 | 9 | set I := { 1 .. columns }; 10 | set IxI := I * I; 11 | 12 | set TABU[ in IxI] := { in IxI with 13 | (m != i or n != j) and (m == i or n == j or abs(m - i) == abs(n - j)) }; 14 | 15 | var x[IxI] binary; 16 | 17 | maximize queens: sum in IxI : x[i,j]; 18 | 19 | subto c1: forall in IxI do 20 | card(TABU[i,j]) - card(TABU[i,j]) * x[i,j] >= sum in TABU[i,j] : x[m,n]; 21 | 22 | -------------------------------------------------------------------------------- /samples/GAP/example.gd: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | ## 3 | #W example.gd 4 | ## 5 | ## This file contains a sample of a GAP declaration file. 6 | ## 7 | DeclareProperty( "SomeProperty", IsLeftModule ); 8 | DeclareGlobalFunction( "SomeGlobalFunction" ); 9 | 10 | 11 | ############################################################################# 12 | ## 13 | #C IsQuuxFrobnicator() 14 | ## 15 | ## 16 | ## 17 | ## 18 | ## 19 | ## Tests whether R is a quux frobnicator. 20 | ## 21 | ## 22 | ## 23 | DeclareSynonym( "IsQuuxFrobnicator", IsField and IsGroup ); 24 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoodsFin.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Aarne Ranta under LGPL 2 | 3 | instance LexFoodsFin of LexFoods = 4 | open SyntaxFin, ParadigmsFin in { 5 | flags coding=utf8; 6 | oper 7 | wine_N = mkN "viini" ; 8 | pizza_N = mkN "pizza" ; 9 | cheese_N = mkN "juusto" ; 10 | fish_N = mkN "kala" ; 11 | fresh_A = mkA "tuore" ; 12 | warm_A = mkA 13 | (mkN "lämmin" "lämpimän" "lämmintä" "lämpimänä" "lämpimään" 14 | "lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin" 15 | ) 16 | "lämpimämpi" "lämpimin" ; 17 | italian_A = mkA "italialainen" ; 18 | expensive_A = mkA "kallis" ; 19 | delicious_A = mkA "herkullinen" ; 20 | boring_A = mkA "tylsä" ; 21 | } 22 | -------------------------------------------------------------------------------- /samples/Prolog/turing.pl: -------------------------------------------------------------------------------- 1 | -turing(Tape0, Tape) :- 2 | - perform(q0, [], Ls, Tape0, Rs), 3 | - reverse(Ls, Ls1), 4 | - append(Ls1, Rs, Tape). 5 | - 6 | -perform(qf, Ls, Ls, Rs, Rs) :- !. 7 | -perform(Q0, Ls0, Ls, Rs0, Rs) :- 8 | - symbol(Rs0, Sym, RsRest), 9 | - once(rule(Q0, Sym, Q1, NewSym, Action)), 10 | - action(Action, Ls0, Ls1, [NewSym|RsRest], Rs1), 11 | - perform(Q1, Ls1, Ls, Rs1, Rs). 12 | - 13 | -symbol([], b, []). 14 | -symbol([Sym|Rs], Sym, Rs). 15 | - 16 | -action(left, Ls0, Ls, Rs0, Rs) :- left(Ls0, Ls, Rs0, Rs). 17 | -action(stay, Ls, Ls, Rs, Rs). 18 | -action(right, Ls0, [Sym|Ls0], [Sym|Rs], Rs). 19 | - 20 | -left([], [], Rs0, [b|Rs0]). 21 | -left([L|Ls], Ls, Rs, [L|Rs]). 22 | -------------------------------------------------------------------------------- /samples/Python/MoveEye.pyde: -------------------------------------------------------------------------------- 1 | """ 2 | * Move Eye. 3 | * by Simon Greenwold. 4 | * 5 | * The camera lifts up (controlled by mouseY) while looking at the same point. 6 | """ 7 | 8 | 9 | def setup(): 10 | size(640, 360, P3D) 11 | fill(204) 12 | 13 | 14 | def draw(): 15 | lights() 16 | background(0) 17 | 18 | # Change height of the camera with mouseY 19 | camera(30.0, mouseY, 220.0, # eyeX, eyeY, eyeZ 20 | 0.0, 0.0, 0.0, # centerX, centerY, centerZ 21 | 0.0, 1.0, 0.0) # upX, upY, upZ 22 | 23 | noStroke() 24 | box(90) 25 | stroke(255) 26 | line(-100, 0, 0, 100, 0, 0) 27 | line(0, -100, 0, 0, 100, 0) 28 | line(0, 0, -100, 0, 0, 100) 29 | 30 | -------------------------------------------------------------------------------- /samples/E/minChat.E: -------------------------------------------------------------------------------- 1 | # from 2 | # http://wiki.erights.org/wiki/Walnut/Secure_Distributed_Computing/Auditing_minChat 3 | pragma.syntax("0.9") 4 | to send(message) { 5 | when (friend<-receive(message)) -> { 6 | chatUI.showMessage("self", message) 7 | } catch prob {chatUI.showMessage("system", "connection lost")} 8 | } 9 | to receive(message) {chatUI.showMessage("friend", message)} 10 | to receiveFriend(friendRcvr) { 11 | bind friend := friendRcvr 12 | chatUI.showMessage("system", "friend has arrived") 13 | } 14 | to save(file) {file.setText(makeURIFromObject(chatController))} 15 | to load(file) { 16 | bind friend := getObjectFromURI(file.getText()) 17 | friend <- receiveFriend(chatController) 18 | } 19 | -------------------------------------------------------------------------------- /samples/IDL/mg_acosh.pro: -------------------------------------------------------------------------------- 1 | ; docformat = 'rst' 2 | 3 | ;+ 4 | ; Inverse hyperbolic cosine. Uses the formula: 5 | ; 6 | ; $$\text{acosh}(z) = \ln(z + \sqrt{z + 1} \sqrt{z - 1})$$ 7 | ; 8 | ; :Examples: 9 | ; The arc hyperbolic sine function looks like:: 10 | ; 11 | ; IDL> x = 2.5 * findgen(1000) / 999. + 1. 12 | ; IDL> plot, x, mg_acosh(x), xstyle=1 13 | ; 14 | ; This should look like: 15 | ; 16 | ; .. image:: acosh.png 17 | ; 18 | ; :Returns: 19 | ; float, double, complex, or double complex depending on the input 20 | ; 21 | ; :Params: 22 | ; z : in, required, type=numeric 23 | ; input 24 | ;- 25 | function mg_acosh, z 26 | compile_opt strictarr 27 | 28 | return, alog(z + sqrt(z + 1) * sqrt(z - 1)) 29 | end -------------------------------------------------------------------------------- /samples/Clean/stack.icl: -------------------------------------------------------------------------------- 1 | implementation module stack 2 | import StdEnv 3 | 4 | :: Stack a :== [a] 5 | 6 | newStack :: (Stack a) 7 | newStack = [] 8 | 9 | push :: a (Stack a) -> Stack a 10 | push x s = [x:s] 11 | 12 | pushes :: [a] (Stack a) -> Stack a 13 | pushes x s = x ++ s 14 | 15 | pop :: (Stack a) -> Stack a 16 | pop [] = abort "Cannot use pop on an empty stack" 17 | pop [e:s] = s 18 | 19 | popn :: Int (Stack a) -> Stack a 20 | popn n s = drop n s 21 | 22 | top :: (Stack a) -> a 23 | top [] = abort "Cannot use top on an empty stack" 24 | top [e:s] = e 25 | 26 | topn :: Int (Stack a) -> [a] 27 | topn n s = take n s 28 | elements :: (Stack a) -> [a] 29 | elements s = s 30 | 31 | count :: (Stack a) -> Int 32 | count s = length s 33 | 34 | -------------------------------------------------------------------------------- /samples/XML/sample.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sample 5 | Sample 6 | 0.101.0 7 | Hugh Bot 8 | Hugh Bot 9 | A package of nuget 10 | 11 | It just works 12 | 13 | http://hubot.github.com 14 | 15 | https://github.com/github/hubot/LICENSEmd 16 | false 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/Hack/UsingUserID.hh: -------------------------------------------------------------------------------- 1 | 1 2 | const b = --> 2 3 | var c = ~> 3 4 | d = ~~> 10_000_000km * 500ms 5 | e = (a) -> (b) ~> (c) --> (d, e) ~~> 5 6 | dashes-identifiers = -> 7 | a - a 8 | b -- c 9 | 1-1 1- -1 10 | a- a 11 | a -a 12 | underscores_i$d = -> 13 | /regexp1/ and //regexp2//g 14 | 'strings' and "strings" and \strings 15 | ([2 til 10] or [1 to 50]) 16 | |> map (* 2) 17 | |> filter (> 5) 18 | |> fold (+) 19 | 20 | class Class extends Anc-est-or 21 | (args) -> 22 | 23 | copy = (from, to, callback) --> 24 | error, data <- read file 25 | return callback error if error? 26 | error <~ write file, data 27 | return callback error if error? 28 | callback() 29 | 30 | -> 31 | ~> 32 | ~~> 33 | --> 34 | # Comment 35 | /* Comment */ 36 | -------------------------------------------------------------------------------- /samples/Matlab/Lagr.m: -------------------------------------------------------------------------------- 1 | function [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu) 2 | % [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu) 3 | % Lagr This function computes the coordinates of the Lagrangian points, 4 | % given the mass parameter 5 | yl1=0; 6 | yl2=0; 7 | yl3=0; 8 | yl4=sqrt(3)/2; 9 | yl5=-sqrt(3)/2; 10 | c1=roots([1 mu-3 3-2*mu -mu 2*mu -mu]); 11 | c2=roots([1 3-mu 3-2*mu -mu -2*mu -mu]); 12 | c3=roots([1 2+mu 1+2*mu mu-1 2*mu-2 mu-1]); 13 | xl1=0; 14 | xl2=0; 15 | for i=1:5 16 | if isreal(c1(i)) 17 | xl1=1-mu-c1(i); 18 | end 19 | if isreal(c2(i)) 20 | xl2=1-mu+c2(i); 21 | end 22 | if isreal(c3(i)) 23 | xl3=-mu-c3(i); 24 | end 25 | end 26 | xl4=0.5-mu; 27 | xl5=xl4; 28 | end -------------------------------------------------------------------------------- /samples/Matlab/matlab_class.m: -------------------------------------------------------------------------------- 1 | classdef matlab_class 2 | properties 3 | R; 4 | G; 5 | B; 6 | end 7 | methods 8 | function obj = matlab_class(r,g,b) 9 | obj.R = r; 10 | obj.G = g; 11 | obj.B = b; 12 | end 13 | function disp(obj) 14 | disp(['Red: ' num2str(obj.R) ... 15 | ', Green: ' num2str(obj.G) ... 16 | ', Blue: ' num2str(obj.B)]); 17 | end 18 | end 19 | enumeration 20 | red (1,0,0) 21 | green (0,1,0) 22 | blue (0,0,1) 23 | cyan (0,1,1) 24 | magenta (1,0,1) 25 | yellow (1,1,0) 26 | black (0,0,0) 27 | white (1,1,1) 28 | end 29 | end -------------------------------------------------------------------------------- /samples/Shell/rbenv-sh-shell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | [ -n "$RBENV_DEBUG" ] && set -x 4 | 5 | # Provide rbenv completions 6 | if [ "$1" = "--complete" ]; then 7 | echo --unset 8 | echo system 9 | exec rbenv-versions --bare 10 | fi 11 | 12 | version="$1" 13 | 14 | if [ -z "$version" ]; then 15 | if [ -z "$RBENV_VERSION" ]; then 16 | echo "rbenv: no shell-specific version configured" >&2 17 | exit 1 18 | else 19 | echo "echo \"\$RBENV_VERSION\"" 20 | exit 21 | fi 22 | fi 23 | 24 | if [ "$version" = "--unset" ]; then 25 | echo "unset RBENV_VERSION" 26 | exit 1 27 | fi 28 | 29 | # Make sure the specified version is installed. 30 | rbenv-prefix "$version" >/dev/null 31 | 32 | echo "export RBENV_VERSION=\"${version}\"" 33 | -------------------------------------------------------------------------------- /test/fixtures/Binary/github.po: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: x\n" 10 | "POT-Creation-Date: 2009-02-15 09:22+0100\n" 11 | "PO-Revision-Date: 2009-02-15 09:22+0100\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | "MIME-Version: 1.0\n" 15 | "Content-Type: text/plain; charset=UTF-8\n" 16 | "Content-Transfer-Encoding: 8bit\n" 17 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 18 | 19 | #: tools/files/simple_translation.rb:1 20 | msgid "a translation" 21 | msgstr "" 22 | -------------------------------------------------------------------------------- /samples/SQF/macros.hqf: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define SET(VAR,VALUE) private #VAR; VAR = VALUE; 4 | #define CONV(VAR,ARRAY,POOL) VAR = ARRAY select (POOL find VAR); 5 | 6 | #define ALL_HITPOINTS_MAN [ \ 7 | "HitHead", "HitBody", \ 8 | "HitLeftArm", "HitRightArm", \ 9 | "HitLeftLeg","HitRightLeg" \ 10 | ] 11 | 12 | #define ALL_HITPOINTS_VEH [ \ 13 | "HitBody", "HitHull", "HitEngine", "HitFuel", \ 14 | "HitTurret", "HitGun", \ 15 | "HitLTrack", "HitRTrack", \ 16 | "HitLFWheel", "HitRFWheel", "HitLF2Wheel", "HitRF2Wheel", "HitLMWheel", "HitRMWheel", "HitLBWheel", "HitRBWheel", \ 17 | "HitAvionics", "HitHRotor", "HitVRotor", \ 18 | "HitRGlass", "HitLGlass", "HitGlass1", "HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6" \ 19 | ] 20 | -------------------------------------------------------------------------------- /samples/M/indirectfunctions.m: -------------------------------------------------------------------------------- 1 | start ; exercise 2 | set ^car("make")="toyota" 3 | set ^car("model")="corolla" 4 | set ^car("mileage")="$$compute^mileage" 5 | 6 | write !,"Regular computation",! 7 | write "make = ",^car("make"),! 8 | write "model = ",^car("model"),! 9 | write "mileage = ",@^car("mileage")@(150,4),! 10 | 11 | write !,"Pesimist computation",! 12 | set ^car("mileage")="$$computepesimist^mileage" 13 | write "make = ",^car("make"),! 14 | write "model = ",^car("model"),! 15 | write "mileage = ",@^car("mileage")@(150,4),! 16 | 17 | write !,"Optimist computation",! 18 | set ^car("mileage")="$$computeoptimist^mileage" 19 | write "make = ",^car("make"),! 20 | write "model = ",^car("model"),! 21 | write "mileage = ",@^car("mileage")@(150,4),! 22 | 23 | -------------------------------------------------------------------------------- /samples/C/blob.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOB_H 2 | #define BLOB_H 3 | 4 | #include "object.h" 5 | 6 | extern const char *blob_type; 7 | 8 | struct blob { 9 | struct object object; 10 | }; 11 | 12 | struct blob *lookup_blob(const unsigned char *sha1); 13 | 14 | int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size); 15 | 16 | /** 17 | * Blobs do not contain references to other objects and do not have 18 | * structured data that needs parsing. However, code may use the 19 | * "parsed" bit in the struct object for a blob to determine whether 20 | * its content has been found to actually be available, so 21 | * parse_blob_buffer() is used (by object.c) to flag that the object 22 | * has been read successfully from the database. 23 | **/ 24 | 25 | #endif /* BLOB_H */ 26 | -------------------------------------------------------------------------------- /samples/Clojure/svg.cljx: -------------------------------------------------------------------------------- 1 | ^:clj (ns c2.svg 2 | (:use [c2.core :only [unify]] 3 | [c2.maths :only [Pi Tau radians-per-degree 4 | sin cos mean]])) 5 | 6 | ^:cljs (ns c2.svg 7 | (:use [c2.core :only [unify]] 8 | [c2.maths :only [Pi Tau radians-per-degree 9 | sin cos mean]]) 10 | (:require [c2.dom :as dom])) 11 | 12 | ;;Stub for float fn, which does not exist on cljs runtime 13 | ^:cljs (def float identity) 14 | 15 | (defn ->xy 16 | "Convert coordinates (potentially map of `{:x :y}`) to 2-vector." 17 | [coordinates] 18 | (cond 19 | (and (vector? coordinates) (= 2 (count coordinates))) coordinates 20 | (map? coordinates) [(:x coordinates) (:y coordinates)])) 21 | -------------------------------------------------------------------------------- /samples/Jasmin/op2.j: -------------------------------------------------------------------------------- 1 | .class public op2 2 | .super java/lang/Object 3 | ; 4 | ; standard initializer (calls java.lang.Object's initializer) 5 | ; 6 | .method public ()V 7 | aload_0 8 | invokenonvirtual java/lang/Object/()V 9 | return 10 | .end method 11 | 12 | .method public static main([Ljava/lang/String;)V 13 | 14 | .limit locals 1 15 | .limit stack 5 16 | BeginGlobal: 17 | .line 2 18 | getstatic java/lang/System/out Ljava/io/PrintStream; 19 | ldc 0x1 20 | ldc 0x0 21 | iand 22 | invokevirtual java/io/PrintStream/println(Z)V 23 | 24 | .line 3 25 | getstatic java/lang/System/out Ljava/io/PrintStream; 26 | ldc 0x1 27 | ldc 0x0 28 | ior 29 | invokevirtual java/io/PrintStream/println(Z)V 30 | 31 | EndGlobal: 32 | return 33 | .end method 34 | 35 | -------------------------------------------------------------------------------- /samples/Puppet/unmanaged-notify-puppet25.pp: -------------------------------------------------------------------------------- 1 | # Manually manage /tmp/original 2 | # Each puppet run will copy it to /tmp/flag if there's a change and notify 3 | # the exec when it changes. 4 | # 5 | # The idea here is you might need (in some case) to manually manage a file outside 6 | # of puppet (in this case, "/tmp/original"). Using this example, you can make puppet 7 | # signal other parts of your catalog based on changes to that file. 8 | 9 | file { 10 | # This will, when different, copy /tmp/original to /tmp/flag and notify our 11 | # exec. 12 | "/tmp/flag": 13 | source => "file:///tmp/original", 14 | notify => Exec["hello world"]; 15 | } 16 | 17 | exec { 18 | "hello world": 19 | command => "/bin/echo hello world", 20 | refreshonly => true; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/LexFoodsCat.gf: -------------------------------------------------------------------------------- 1 | -- (c) 2009 Jordi Saludes under LGPL 2 | 3 | instance LexFoodsCat of LexFoods = 4 | open SyntaxCat, ParadigmsCat, (M = MorphoCat) in { 5 | flags 6 | coding = utf8 ; 7 | oper 8 | wine_N = mkN "vi" "vins" M.Masc ; 9 | pizza_N = mkN "pizza" ; 10 | cheese_N = mkN "formatge" ; 11 | fish_N = mkN "peix" "peixos" M.Masc; 12 | fresh_A = mkA "fresc" "fresca" "frescos" "fresques" "frescament"; 13 | warm_A = mkA "calent" ; 14 | italian_A = mkA "italià" "italiana" "italians" "italianes" "italianament" ; 15 | expensive_A = mkA "car" ; 16 | delicious_A = mkA "deliciós" "deliciosa" "deliciosos" "delicioses" "deliciosament"; 17 | boring_A = mkA "aburrit" "aburrida" "aburrits" "aburrides" "aburridament" ; 18 | } 19 | -------------------------------------------------------------------------------- /samples/Swift/section-57.swift: -------------------------------------------------------------------------------- 1 | class EquilateralTriangle: NamedShape { 2 | var sideLength: Double = 0.0 3 | 4 | init(sideLength: Double, name: String) { 5 | self.sideLength = sideLength 6 | super.init(name: name) 7 | numberOfSides = 3 8 | } 9 | 10 | var perimeter: Double { 11 | get { 12 | return 3.0 * sideLength 13 | } 14 | set { 15 | sideLength = newValue / 3.0 16 | } 17 | } 18 | 19 | override func simpleDescription() -> String { 20 | return "An equilateral triagle with sides of length \(sideLength)." 21 | } 22 | } 23 | var triangle = EquilateralTriangle(sideLength: 3.1, name: "a triangle") 24 | triangle.perimeter 25 | triangle.perimeter = 9.9 26 | triangle.sideLength 27 | -------------------------------------------------------------------------------- /samples/Objective-C/MainMenuViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2009-2011 Facebook 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | @interface MainMenuViewController : TTTableViewController { 18 | 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /samples/fish/eval.fish: -------------------------------------------------------------------------------- 1 | 2 | function eval -S -d "Evaluate parameters as a command" 3 | 4 | # If we are in an interactive shell, eval should enable full 5 | # job control since it should behave like the real code was 6 | # executed. If we don't do this, commands that expect to be 7 | # used interactively, like less, wont work using eval. 8 | 9 | set -l mode 10 | if status --is-interactive-job-control 11 | set mode interactive 12 | else 13 | if status --is-full-job-control 14 | set mode full 15 | else 16 | set mode none 17 | end 18 | end 19 | if status --is-interactive 20 | status --job-control full 21 | end 22 | 23 | echo "begin; $argv ;end eval2_inner <&3 3<&-" | . 3<&0 24 | set -l res $status 25 | 26 | status --job-control $mode 27 | return $res 28 | end 29 | -------------------------------------------------------------------------------- /samples/M/arrays.m: -------------------------------------------------------------------------------- 1 | start ; create student data 2 | set student("name","first")="Linus" 3 | set student("name","last")="Torvalds" 4 | set student("language")="C" 5 | set student("classes","monday")="Algebra" 6 | set student("classes","tuesday")="Geometry" 7 | set student("classes","wednesday")="English" 8 | set student("classes","thursday")="French" 9 | set student("classes","friday")="Jujitsu" 10 | zwrite student 11 | write $order(student) 12 | 13 | write !,"Student array top level",! 14 | set x="" 15 | for do quit:x="" 16 | . set x=$order(student(x)) 17 | . write x,! 18 | 19 | write !,"Student classes ",! 20 | set x="" 21 | for do quit:x="" 22 | . set x=$order(student("classes",x)) 23 | . write:x'="" x," : ",student("classes",x),! 24 | 25 | quit 26 | -------------------------------------------------------------------------------- /samples/G-code/duettest.g: -------------------------------------------------------------------------------- 1 | ; RepRapPro Ormerod 2 | ; Board test GCodes 3 | M111 S1; Debug on 4 | G21 ; mm 5 | G90 ; Absolute positioning 6 | M83 ; Extrusion relative 7 | M906 X800 Y800 Z800 E800 ; Motor currents (mA) 8 | T0 ; Extruder 0 9 | G1 X50 F500 10 | G1 X0 11 | G4 P500 12 | G1 Y50 F500 13 | G1 Y0 14 | G4 P500 15 | G1 Z20 F200 16 | G1 Z0 17 | G4 P500 18 | G1 E20 F200 19 | G1 E-20 20 | G4 P500 21 | M106 S255 22 | G4 P500 23 | M106 S0 24 | G4 P500 25 | M105 26 | G10 P0 S100 27 | T0 28 | M140 S100 29 | G4 P5000 30 | M105 31 | G4 P5000 32 | M105 33 | G4 P5000 34 | M105 35 | G4 P5000 36 | M105 37 | G4 P5000 38 | M105 39 | G4 P5000 40 | M105 41 | G4 P5000 42 | M105 43 | G4 P5000 44 | M105 45 | G4 P5000 46 | M105 47 | G4 P5000 48 | M105 49 | G4 P5000 50 | M105 51 | G4 P5000 52 | M105 53 | M0 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /samples/Golo/helloworld.golo: -------------------------------------------------------------------------------- 1 | # Copyright 2012-2014 Institut National des Sciences Appliquées de Lyon (INSA-Lyon) 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module hello.World 16 | 17 | function main = |args| { 18 | println("Hello world!") 19 | } 20 | 21 | -------------------------------------------------------------------------------- /samples/JavaScript/helloHanaEndpoint.xsjs: -------------------------------------------------------------------------------- 1 | /* 2 | invoke endpoint by calling in a browser: 3 | http://:////helloHanaMath.xsjslib?x=4&y=2 4 | e.g.: 5 | http://192.168.178.20:8000/geekflyer/linguist/helloHanaEndpoint.xsjs?x=4&y=2 6 | */ 7 | 8 | var hanaMath = $.import("./helloHanaMath.xsjslib"); 9 | 10 | var x = parseFloat($.request.parameters.get("x")); 11 | var y = parseFloat($.request.parameters.get("y")); 12 | 13 | 14 | var result = hanaMath.multiply(x, y); 15 | 16 | var output = { 17 | title: "Hello HANA XS - do some simple math", 18 | input: {x: x, y: y}, 19 | result: result 20 | }; 21 | 22 | $.response.contentType = "application/json"; 23 | $.response.statusCode = $.net.http.OK; 24 | $.response.setBody(JSON.stringify(output)); -------------------------------------------------------------------------------- /samples/Swift/section-59.swift: -------------------------------------------------------------------------------- 1 | class TriangleAndSquare { 2 | var triangle: EquilateralTriangle { 3 | willSet { 4 | square.sideLength = newValue.sideLength 5 | } 6 | } 7 | var square: Square { 8 | willSet { 9 | triangle.sideLength = newValue.sideLength 10 | } 11 | } 12 | init(size: Double, name: String) { 13 | square = Square(sideLength: size, name: name) 14 | triangle = EquilateralTriangle(sideLength: size, name: name) 15 | } 16 | } 17 | var triangleAndSquare = TriangleAndSquare(size: 10, name: "another test shape") 18 | triangleAndSquare.square.sideLength 19 | triangleAndSquare.triangle.sideLength 20 | triangleAndSquare.square = Square(sideLength: 50, name: "larger square") 21 | triangleAndSquare.triangle.sideLength 22 | -------------------------------------------------------------------------------- /samples/Jasmin/if4.j: -------------------------------------------------------------------------------- 1 | .class public if4 2 | .super java/lang/Object 3 | ; 4 | ; standard initializer (calls java.lang.Object's initializer) 5 | ; 6 | .method public ()V 7 | aload_0 8 | invokenonvirtual java/lang/Object/()V 9 | return 10 | .end method 11 | 12 | .method public static main([Ljava/lang/String;)V 13 | 14 | .limit locals 1 15 | .limit stack 5 16 | BeginGlobal: 17 | .line 2 18 | ldc 0x1 19 | ldc 0x1 20 | if_icmpne IfNot1919266740 21 | .line 2 22 | .line 2 23 | ldc 0x1 24 | ldc 0x1 25 | if_icmpne IfNot613368541 26 | .line 2 27 | .line 2 28 | getstatic java/lang/System/out Ljava/io/PrintStream; 29 | ldc 0x1 30 | invokevirtual java/io/PrintStream/print(I)V 31 | IfNot613368541: 32 | IfNot1919266740: 33 | 34 | EndGlobal: 35 | return 36 | .end method 37 | 38 | -------------------------------------------------------------------------------- /samples/Objective-C/PlaygroundViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2009-2011 Facebook 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | 18 | @interface PlaygroundViewController : UIViewController { 19 | UIScrollView* _scrollView; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /samples/Cirru/stdio.cirru: -------------------------------------------------------------------------------- 1 | 2 | set a $ string 1 3 | print a 4 | 5 | print (string 1) 6 | 7 | print nothing 8 | 9 | print 10 | map 11 | a (int 4) 12 | b $ map 13 | a $ int 5 14 | b $ int 6 15 | c $ map 16 | int 7 17 | 18 | print 19 | array 20 | int 1 21 | int 2 22 | array 23 | int 3 24 | int 4 25 | 26 | print 27 | array 28 | int 1 29 | map 30 | a $ int 2 31 | b $ array 32 | int 3 33 | 34 | print 35 | int 1 36 | int 2 37 | 38 | print $ code 39 | set a 1 40 | print (get a) 41 | print $ array 42 | int a 43 | array 44 | int a 45 | 46 | set container (map) 47 | set container code $ code 48 | set a 1 49 | print (get a) 50 | print $ array 51 | int a 52 | array 53 | int a 54 | 55 | print container -------------------------------------------------------------------------------- /samples/CMake/sample4.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.6) 2 | 3 | set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") 4 | 5 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/vala) 6 | find_package(Vala REQUIRED) 7 | include(ValaPrecompile) 8 | include(ValaVersion) 9 | ensure_vala_version("0.11.0" MINIMUM) 10 | 11 | project (template C) 12 | 13 | find_package(PkgConfig) 14 | 15 | pkg_check_modules(GOBJECT REQUIRED gobject-2.0) 16 | add_definitions(${GOBJECT_CFLAGS} ${GOBJECT_CFLAGS_OTHER}) 17 | link_libraries(${GOBJECT_LIBRARIES}) 18 | link_directories(${GOBJECT_LIBRARY_DIRS}) 19 | 20 | 21 | vala_precompile(VALA_C 22 | src/template.vala 23 | PACKAGES 24 | OPTIONS 25 | --thread 26 | CUSTOM_VAPIS 27 | GENERATE_VAPI 28 | GENERATE_HEADER 29 | DIRECTORY 30 | gen 31 | ) 32 | 33 | add_executable("template" ${VALA_C}) 34 | -------------------------------------------------------------------------------- /samples/Hack/Documentation.hh: -------------------------------------------------------------------------------- 1 | getAttribute('name'))).".php"; 19 | $href = "http://hhvm.com/manual/en/$name"; 20 | return docs →; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/Slim/sample.slim: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title Slim Examples 5 | meta name="keywords" content="template language" 6 | meta name="author" content=author 7 | javascript: 8 | alert('Slim supports embedded javascript!') 9 | 10 | body 11 | h1 Markup examples 12 | 13 | #content 14 | p This example shows you how a basic Slim file looks like. 15 | 16 | == yield 17 | 18 | - unless items.empty? 19 | table 20 | - for item in items do 21 | tr 22 | td.name = item.name 23 | td.price = item.price 24 | - else 25 | p 26 | | No items found. Please add some inventory. 27 | Thank you! 28 | 29 | div id="footer" 30 | = render 'footer' 31 | | Copyright © #{year} #{author} 32 | -------------------------------------------------------------------------------- /script/travis/before_install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | # Fetch all commits/refs needed to run our tests. 6 | git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master 7 | 8 | script/vendor-deb libicu48 libicu-dev 9 | if ruby -e 'exit RUBY_VERSION >= "2.0" && RUBY_VERSION < "2.1"'; then 10 | # Workaround for https://bugs.ruby-lang.org/issues/8074. We can't use this 11 | # solution on all versions of Ruby due to 12 | # https://github.com/bundler/bundler/pull/3338. 13 | bundle config build.charlock_holmes --with-icu-include=$(pwd)/vendor/debs/include --with-icu-lib=$(pwd)/vendor/debs/lib 14 | else 15 | bundle config build.charlock_holmes --with-icu-dir=$(pwd)/vendor/debs 16 | fi 17 | 18 | git submodule init 19 | git submodule sync --quiet 20 | script/fast-submodule-update 21 | -------------------------------------------------------------------------------- /samples/Grammatical Framework/FoodsOri.gf: -------------------------------------------------------------------------------- 1 | concrete FoodsOri of Foods = { 2 | 3 | flags coding = utf8 ; 4 | 5 | lincat 6 | Comment = Str; 7 | Item = Str; 8 | Kind = Str; 9 | Quality = Str; 10 | 11 | lin 12 | Pred item quality = item ++ quality ++ "ଅଟେ"; 13 | This kind = "ଏଇ" ++ kind; 14 | That kind = "ସେଇ" ++ kind; 15 | These kind = "ଏଇ" ++ kind ++ "ଗୁଡିକ" ; 16 | Those kind = "ସେଇ" ++ kind ++ "ଗୁଡିକ" ; 17 | Mod quality kind = quality ++ kind; 18 | Wine = "ମଦ"; 19 | Cheese = "ଛେନା"; 20 | Fish = "ମାଛ"; 21 | Pizza = "ପିଜଜ଼ା" ; 22 | Very quality = "ଅତି" ++ quality; 23 | Fresh = "ତାଜା"; 24 | Warm = "ଗରମ"; 25 | Italian = "ଇଟାଲି"; 26 | Expensive = "ମୁଲ୍ୟବାନ୍"; 27 | Delicious = "ସ୍ଵାଦିସ୍ଟ "; 28 | Boring = "ଅରୁଚିକର"; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /samples/Perl/fib.pl: -------------------------------------------------------------------------------- 1 | #! perl 2 | # Copyright (C) 2001-2003, Parrot Foundation. 3 | 4 | =head1 NAME 5 | 6 | examples/benchmarks/fib.pl - Fibonacci Benchmark 7 | 8 | =head1 SYNOPSIS 9 | 10 | % time perl examples/benchmarks/fib.pl n 11 | 12 | =head1 DESCRIPTION 13 | 14 | Calculates the Fibonacci Number for C (defaults to 28 if 15 | unspecified). 16 | 17 | =cut 18 | 19 | use strict; 20 | use warnings; 21 | 22 | sub fib { 23 | my $n = shift; 24 | return $n if ( $n < 2 ); 25 | return fib( $n - 1 ) + fib( $n - 2 ); 26 | } 27 | my $N = shift || 28; 28 | 29 | print "fib($N) = ", fib($N), "\n"; 30 | 31 | =head1 SEE ALSO 32 | 33 | F. 34 | 35 | =cut 36 | 37 | # Local Variables: 38 | # mode: cperl 39 | # cperl-indent-level: 4 40 | # fill-column: 100 41 | # End: 42 | # vim: expandtab shiftwidth=4: 43 | -------------------------------------------------------------------------------- /samples/M/ifelse.m: -------------------------------------------------------------------------------- 1 | if1 ; simple if statement 2 | set a=5 3 | set b=10 4 | set c=25 5 | if (a { } 5 | 6 | token backslash:sym { } 7 | token backslash:sym<\\> { } 8 | token backslash:sym { } 9 | 10 | token backslash:sym { {} . } 11 | 12 | method tweak_q($v) { self.panic("Too late for :q") } 13 | method tweak_qq($v) { self.panic("Too late for :qq") } 14 | } 15 | 16 | role qq does b1 does c1 does s1 does a1 does h1 does f1 { 17 | token stopper { \" } 18 | token backslash:sym { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } } 19 | token backslash:sym { \W } 20 | 21 | method tweak_q($v) { self.panic("Too late for :q") } 22 | method tweak_qq($v) { self.panic("Too late for :qq") } 23 | } 24 | -------------------------------------------------------------------------------- /samples/JSONLD/sample.jsonld: -------------------------------------------------------------------------------- 1 | { 2 | "@context": { 3 | "property": "http://example.com/vocab#property" 4 | }, 5 | "@id": "../document-relative", 6 | "@type": "#document-relative", 7 | "property": { 8 | "@context": { 9 | "@base": "http://example.org/test/" 10 | }, 11 | "@id": "../document-base-overwritten", 12 | "@type": "#document-base-overwritten", 13 | "property": [ 14 | { 15 | "@context": null, 16 | "@id": "../document-relative", 17 | "@type": "#document-relative", 18 | "property": "context completely reset, drops property" 19 | }, 20 | { 21 | "@context": { 22 | "@base": null 23 | }, 24 | "@id": "../document-relative", 25 | "@type": "#document-relative", 26 | "property": "only @base is cleared" 27 | } 28 | ] 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /samples/Gnuplot/histograms.2.gnu: -------------------------------------------------------------------------------- 1 | # set terminal pngcairo transparent enhanced font "arial,10" fontscale 1.0 size 500, 350 2 | # set output 'histograms.2.png' 3 | set boxwidth 0.9 absolute 4 | set style fill solid 1.00 border lt -1 5 | set key inside right top vertical Right noreverse noenhanced autotitles nobox 6 | set style histogram clustered gap 1 title offset character 0, 0, 0 7 | set datafile missing '-' 8 | set style data histograms 9 | set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify 10 | set xtics norangelimit font ",8" 11 | set xtics () 12 | set title "US immigration from Northern Europe\nPlot selected data columns as histogram of clustered boxes" 13 | set yrange [ 0.00000 : 300000. ] noreverse nowriteback 14 | i = 22 15 | plot 'immigration.dat' using 6:xtic(1) ti col, '' u 12 ti col, '' u 13 ti col, '' u 14 ti col 16 | -------------------------------------------------------------------------------- /samples/Nit/print_arguments.nit: -------------------------------------------------------------------------------- 1 | # This file is part of NIT ( http://www.nitlanguage.org ). 2 | # 3 | # Copyright 2004-2008 Jean Privat 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # How to print arguments of the command line. 18 | module print_arguments 19 | 20 | for a in args do 21 | print a 22 | end 23 | -------------------------------------------------------------------------------- /samples/Processing/hello.pde: -------------------------------------------------------------------------------- 1 | /** 2 | * Shape Primitives. 3 | * 4 | * The basic shape primitive functions are triangle(), 5 | * rect(), quad(), ellipse(), and arc(). Squares are made 6 | * with rect() and circles are made with ellipse(). Each 7 | * of these functions requires a number of parameters to 8 | * determine the shape's position and size. 9 | */ 10 | 11 | void setup() { 12 | size(640, 360); 13 | background(0); 14 | noStroke(); 15 | } 16 | 17 | void draw() { 18 | fill(204); 19 | triangle(18, 18, 18, 360, 81, 360); 20 | 21 | fill(102); 22 | rect(81, 81, 63, 63); 23 | 24 | fill(204); 25 | quad(189, 18, 216, 18, 216, 360, 144, 360); 26 | 27 | fill(255); 28 | ellipse(252, 144, 72, 72); 29 | 30 | fill(204); 31 | triangle(288, 18, 351, 360, 288, 360); 32 | 33 | fill(255); 34 | arc(479, 300, 280, 280, PI, TWO_PI); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /samples/Forth/block.fth: -------------------------------------------------------------------------------- 1 | ( Block words. ) 2 | 3 | variable blk 4 | variable current-block 5 | 6 | : block ( n -- addr ) 7 | current-block ! 0 ; 8 | 9 | : buffer ( n -- addr ) 10 | current-block ! 0 ; 11 | 12 | \ evaluate (extended semantics) 13 | \ flush ( -- ) 14 | 15 | : load ( ... n -- ... ) 16 | dup current-block ! 17 | blk ! 18 | save-input 19 | 0 >in ! 20 | blk @ block ''source ! 1024 ''#source ! 21 | ( interpret ) 22 | restore-input ; 23 | 24 | \ save-buffers ( -- ) 25 | \ update ( -- ) 26 | 27 | ( Block extension words. ) 28 | 29 | \ empty-buffers ( -- ) 30 | 31 | variable scr 32 | 33 | : list ( n -- ) 34 | dup scr ! 35 | dup current-block ! 36 | block 1024 bounds do i @ emit loop ; 37 | 38 | \ refill (extended semantics) 39 | 40 | : thru ( x y -- ) +1 swap do i load loop ; 41 | 42 | \ \ (extended semantics) 43 | -------------------------------------------------------------------------------- /samples/Matlab/par_text_to_struct.m: -------------------------------------------------------------------------------- 1 | function par = par_text_to_struct(pathToFile) 2 | % function par = par_text_to_struct(pathToFile) 3 | % Returns a structure of the parameters that were stored in a csv text file. 4 | % 5 | % Parameters 6 | % ---------- 7 | % pathToFile : string 8 | % Path to a text file containing the benchmark parameters for a single 9 | % bicycle. The parameters should be on seperate lines and take this form: 10 | % 11 | % c = 0.08+/-0.01 12 | % lam = 0.31 13 | % 14 | % Returns 15 | % ------- 16 | % par : structure 17 | % A structure containing the bicycle parameters. 18 | 19 | fid = fopen(pathToFile); 20 | data = textscan(fid, '%s %s', 'delimiter', '='); 21 | fclose(fid); 22 | names = strtrim(data{1}); 23 | vals = strtrim(regexp(data{2}, '+/-', 'split')); 24 | for i = 1:length(names) 25 | v = vals{i}; 26 | par.(names{i}) = str2num(v{1}); 27 | end 28 | --------------------------------------------------------------------------------