-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
4168 lines (3427 loc) · 100 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Demo page — Highlight.js plugin for display language of syntax highlight by Yauheni Pakala</title>
<meta property="og:title" content="Highlight.js plugin for display language of syntax highlight by Yauheni Pakala" />
<meta property="og:locale" content="en_US" />
<link rel="canonical" href="https://wcoder.github.io/highlightjs-line-numbers.js/" />
<meta property="og:url" content="https://wcoder.github.io/highlightjs-line-numbers.js/" />
<meta property="og:site_name" content="Highlight.js plugin for display language of syntax highlight" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script>
<!-- <script src="src/highlightjs-lang.js"></script> -->
<script src="dist/highlightjs-lang.min.js"></script>
<script>
hljs.highlightAll();
// init plugin:
hljs.initLangOnLoad(
{
overrideNames: {
dart: 'Dart',
},
fallback: function (lang) {
if (lang === 'php') {
return '$ PHP $';
}
return lang;
},
}
);
</script>
<style>
.hljs-lang {
background: #333;
text-align: center;
color: #fff;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#wrapper {
max-width: 700px;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="wrapper">
<h2>1C</h2>
<pre><code class="1c">#Если Клиент Тогда
Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий
Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции
x=ТекстСообщения+ТекстСообщения2+"
|строка1
|строка2
|строка3";
КонецФункции
#КонецЕсли
// Процедура ПриНачалеРаботыСистемы
//
Процедура ПриНачалеРаботыСистемы()
Обработки.Помощник.ПолучитьФорму("Форма").Открыть();
d = '21.01.2008'
КонецПроцедуры
</code></pre>
<h2>ActionScript</h2>
<pre><code class="actionscript">package org.example.dummy {
import org.dummy.*;
/*define package inline interface*/
public interface IFooBarzable {
public function foo(... pairs):Array;
}
public class FooBar implements IFooBarzable {
static private var cnt:uint = 0;
private var bar:String;
//constructor
public function TestBar(bar:String):void {
bar = bar;
++cnt;
}
public function foo(... pairs):Array {
pairs.push(bar);
return pairs;
}
}
}</code></pre>
<h2>Apache</h2>
<pre><code class="apache"># rewrite`s rules for wordpress pretty url
LoadModule rewrite_module modules/mod_rewrite.so
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [NC,L]
ExpiresActive On
ExpiresByType application/x-javascript "access plus 1 days"
Order Deny,Allow
Allow from All
<Location /maps/>
RewriteMap map txt:map.txt
RewriteMap lower int:tolower
RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
</Location>
</code></pre>
<h2>AppleScript</h2>
<pre><code class="applescript">repeat 5 times
if foo is greater than bar then
display dialog "Hello there"
else
beep
end if
end repeat
(* comment (*nested comment*) *)
on do_something(s, y)
return {s + pi, y mod 4}
end do_something
do shell script "/bin/echo 'hello'"
</code></pre>
<h2>AsciiDoc</h2>
<pre><code class="asciidoc">Hello, World!
============
Author Name, <[email protected]>
you can write text http://example.com[with links], optionally
using an explicit link:http://example.com[link prefix].
* single quotes around a phrase place 'emphasis'
** alternatively, you can put underlines around a phrase to add _emphasis_
* astericks around a phrase make the text *bold*
* pluses around a phrase make it +monospaced+
* `smart' quotes using a leading backtick and trailing single quote
** use two of each for double ``smart'' quotes
- escape characters are supported
- you can escape a quote inside emphasized text like 'here\'s johnny!'
term:: definition
another term:: another definition
// this is just a comment
Let's make a break.
'''
////
we'll be right with you
after this brief interruption.
////
== We're back!
Want to see a image::images/tiger.png[Tiger]?
.Nested highlighting
++++
<this_is inline="xml"></this_is>
++++
____
asciidoc is so powerful.
____
another quote:
[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
____
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
____
Getting Literal
---------------
want to get literal? prefix a line with a space.
....
I'll join that party, too.
....
. one thing (yeah!)
. two thing `i can write code`, and `more` wipee!
NOTE: AsciiDoc is quite cool, you should try it.</code></pre>
<h2>AspectJ</h2>
<pre><code class="aspectj">package com.aspectj.syntax;
import org.aspectj.lang.annotation.AdviceName;
privileged public aspect LoggingAspect percflowbelow(ajia.services.*){
private pointcut getResult() : call(* *(..) throws SQLException) && args(Account, .., int);
@AdviceName("CheckValidEmail")
before (Customer hu) : getResult(hu){
System.out.println("Your mail address is valid!");
}
Object around() throws InsufficientBalanceException: getResult() && call(Customer.new(String,String,int,int,int)){
return proceed();
}
public Cache getCache() {
return this.cache;
}
pointcut beanPropertyChange(BeanSupport bean, Object newValue): execution(void BeanSupport+.set*(*)) && args(newValue) && this(bean);
declare parents: banking.entities.* implements BeanSupport;
declare warning : call(void TestSoftening.perform()): "Please ensure you are not calling this from an AWT thread";
private String Identifiable.id;
public void Identifiable.setId(String id) {
this.id = id;
}
}</code></pre>
<h2>AutoHotkey</h2>
<pre><code class="autohotkey">; hotkeys and hotstrings
#a::WinSet, AlwaysOnTop, Toggle, A
#Space::
MsgBox, Percent sign (`%) need to be escaped.
Run "C:\Program Files\some\program.exe"
Gosub, label1
return
::btw::by the way
; volume
#Numpad8::Send {Volume_Up}
#Numpad5::Send {Volume_Mute}
#Numpad2::Send {Volume_Down}
label1:
if (Clipboard = "")
{
MsgBox, , Clipboard, Empty!
}
else
{
StringReplace, temp, Clipboard, old, new, All
MsgBox, , Clipboard, %temp%
}
return
</code></pre>
<h2>AVR Assembler</h2>
<pre><code class="avrasm">;* Title: Block Copy Routines
;* Version: 1.1
.include "8515def.inc"
rjmp RESET ;reset handle
.def flashsize=r16 ;size of block to be copied
flash2ram:
lpm ;get constant
st Y+,r0 ;store in SRAM and increment Y-pointer
adiw ZL,1 ;increment Z-pointer
dec flashsize
brne flash2ram ;if not end of table, loop more
ret
.def ramtemp =r1 ;temporary storage register
.def ramsize =r16 ;size of block to be copied
</code></pre>
<h2>Axapta</h2>
<pre><code class="axapta">class ExchRateLoadBatch extends RunBaseBatch {
ExchRateLoad rbc;
container currencies;
boolean actual;
boolean overwrite;
date beg;
date end;
#define.CurrentVersion(5)
#localmacro.CurrentList
currencies,
actual,
beg,
end
#endmacro
}
public boolean unpack(container packedClass) {
container base;
boolean ret;
Integer version = runbase::getVersion(packedClass);
switch (version) {
case #CurrentVersion:
[version, #CurrentList] = packedClass;
return true;
default:
return false;
}
return ret;
}
</code></pre>
<h2>Bash</h2>
<pre><code class="bash">#!/bin/bash
###### BEGIN CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false
###### END CONFIG
if [ "$UID" -ne 0 ]
then
echo "Superuser rights is required"
echo 'Printing the # sign'
exit 2
fi
if test $# -eq 0
then
elif test [ $1 == 'start' ]
else
fi
genApacheConf(){
if [[ "$2" = "www" ]]
then
full_domain=$1
else
full_domain=$2.$1
fi
host_root="${APACHE_HOME_DIR}$1/$2/$(title)"
echo -e "# Host $1/$2 :"
}
</code></pre>
<h2>Brainfuck</h2>
<pre><code class="brainfuck">++++++++++
[ 3*10 and 10*10
->+++>++++++++++<<
]>>
[ filling cells
->++>>++>++>+>++>>++>++>++>++>++>++>++>++>++>++>++[</]<[<]<[<]>>
]<
+++++++++<<
[ rough codes correction loop
->>>+>+>+>+++>+>+>+>+>+>+>+>+>+>+>+>+>+>+[<]<
]
more accurate сodes correction
>>>++>
-->+++++++>------>++++++>++>+++++++++>++++++++++>++++++++>--->++++++++++>------>++++++>
++>+++++++++++>++++++++++++>------>+++
rewind and output
[<]>[.>]
</code></pre>
<h2>Cap’n Proto</h2>
<pre><code class="capnproto">@0xdbb9ad1f14bf0b36; # unique file ID, generated by `capnp id`
struct Person {
name @0 :Text;
birthdate @3 :Date;
email @1 :Text;
phones @2 :List(PhoneNumber);
struct PhoneNumber {
number @0 :Text;
type @1 :Type;
enum Type {
mobile @0;
home @1;
work @2;
}
}
}
struct Date {
year @0 :Int16;
month @1 :UInt8;
day @2 :UInt8;
flags @3 :List(Bool) = [ true, false, false, true ];
}
interface Node {
isDirectory @0 () -> (result :Bool);
}
interface Directory extends(Node) {
list @0 () -> (list: List(Entry));
struct Entry {
name @0 :Text;
node @1 :Node;
}
create @1 (name :Text) -> (file :File);
mkdir @2 (name :Text) -> (directory :Directory)
open @3 (name :Text) -> (node :Node);
delete @4 (name :Text);
link @5 (name :Text, node :Node);
}
interface File extends(Node) {
size @0 () -> (size: UInt64);
read @1 (startAt :UInt64 = 0, amount :UInt64 = 0xffffffffffffffff)
-> (data: Data);
# Default params = read entire file.
write @2 (startAt :UInt64, data :Data);
truncate @3 (size :UInt64);
}</code></pre>
<h2>Clojure REPL</h2>
<pre><code class="clojure-repl">user=> (defn f [x y]
#_=> (+ x y))
#'user/f
user=> (f 5 7)
12
user=> nil
nil
</code></pre>
<h2>Clojure</h2>
<pre><code class="clojure">; Comment
(def
^{:macro true
:added "1.0"}
let (fn* let [&form &env & decl] (cons 'let* decl)))
(def ^:dynamic chunk-size 17)
(defn next-chunk [rdr]
(let [buf (char-array chunk-size)
s (.read rdr buf)]
(when (pos? s)
(java.nio.CharBuffer/wrap buf 0 s))))
(defn chunk-seq [rdr]
(when-let [chunk (next-chunk rdr)]
(cons chunk (lazy-seq (chunk-seq rdr)))))
</code></pre>
<h2>CMake</h2>
<pre><code class="cmake">cmake_minimum_required(VERSION 2.8.8)
project(cmake_example)
# Show message on Linux platform
if (${CMAKE_SYSTEM_NAME} MATCHES Linux)
message("Good choice, bro!")
endif()
# Tell CMake to run moc when necessary:
set(CMAKE_AUTOMOC ON)
# As moc files are generated in the binary dir,
# tell CMake to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Widgets finds its own dependencies.
find_package(Qt5Widgets REQUIRED)
add_executable(myproject main.cpp mainwindow.cpp)
qt5_use_modules(myproject Widgets)
</code></pre>
<h2>CoffeeScript</h2>
<pre><code class="coffeescript">grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) ->
if student.excellentWork
"A+"
else if student.okayStuff
if student.triedHard then "B" else "B-"
else
"C"
square = (x) -> x * x
two = -> 2
math =
root: Math.sqrt
square: square
cube: (x) -> x * square x
race = (winner, runners...) ->
print winner, runners
class Animal extends Being
constructor: (@name) ->
move: (meters) ->
alert @name + " moved #{meters}m."
hi = `function() {
return [document.title, "Hello JavaScript"].join(": ");
}`
heredoc = """
CoffeeScript subst test #{ 010 + 0xf / 0b10 + "nested string #{ /\n/ }"}
"""
###
CoffeeScript Compiler v1.2.0
Released under the MIT License
###
OPERATOR = /// ^ (
?: [-=]> # function
) ///
</code></pre>
<h2>C++</h2>
<pre><code class="cpp">#include <iostream>
#define IABS(x) ((x) < 0 ? -(x) : (x))
int main(int argc, char *argv[]) {
/* An annoying "Hello World" example */
for (auto i = 0; i < 0xFFFF; i++)
cout << "Hello, World!" << endl;
char c = '\n';
unordered_map <string, vector<string> > m;
m["key"] = "\\\\"; // this is an error
return -2e3 + 12l;
}
</code></pre>
<h2>C#</h2>
<pre><code class="cs">using System;
#pragma warning disable 414, 3021
public class Program
{
/// <summary>The entry point to the program.</summary>
public static int Main(string[] args)
{
Console.WriteLine("Hello, World!");
string s = @"This
""string""
spans
multiple
lines!";
dynamic x = new ExpandoObject();
x.MyProperty = 2;
return 0;
}
}
async Task<int> AccessTheWebAsync()
{
// ...
string urlContents = await getStringTask;
return urlContents.Length;
}
internal static void ExceptionFilters()
{
try
{
throw new Exception();
}
catch (Exception e) when (e.Message == "My error") { }
}</code></pre>
<h2>CSS</h2>
<pre><code class="css">@media screen and (-webkit-min-device-pixel-ratio: 0) {
body:first-of-type pre::after {
content: 'highlight: ' attr(class);
}
body {
background: linear-gradient(45deg, blue, red);
}
}
@import url('print.css');
@page:right {
margin: 1cm 2cm 1.3cm 4cm;
}
@font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}
div.text,
#content,
li[lang=ru] {
font: Tahoma, Chunkfive, sans-serif;
background: url('hatch.png') /* wtf? */; color: #F0F0F0 !important;
width: 100%;
}
</code></pre>
<h2>D</h2>
<pre><code class="d">#!/usr/bin/rdmd
// Computes average line length for standard input.
import std.stdio;
/+
this is a /+ nesting +/ comment
+/
enum COMPILED_ON = __TIMESTAMP__; // special token
enum character = '©';
enum copy_valid = '&copy;';
enum backslash_escaped = '\\';
// string literals
enum str = `hello "world"!`;
enum multiline = r"lorem
ipsum
dolor"; // wysiwyg string, no escapes here allowed
enum multiline2 = "sit
amet
\"adipiscing\"
elit.";
enum hex = x"66 6f 6f"; // same as "foo"
#line 5
// float literals
enum f = [3.14f, .1, 1., 1e100, 0xc0de.01p+100];
static if (something == true) {
import std.algorithm;
}
void main() pure nothrow @safe {
ulong lines = 0;
double sumLength = 0;
foreach (line; stdin.byLine()) {
++lines;
sumLength += line.length;
}
writeln("Average line length: ",
lines ? sumLength / lines : 0);
}
</code></pre>
<h2>Dart</h2>
<pre><code class="dart">library app;
import 'dart:html';
part 'app2.dart';
/**
* Class description and [link](http://dartlang.org/).
*/
@Awesome('it works!')
class SomeClass<S extends Iterable> extends BaseClass<S> implements Comparable {
factory SomeClass(num param);
SomeClass._internal(int q) : super() {
assert(q != 1);
double z = 0.0;
}
/// **Sum** function
int sum(int a, int b) => a + b;
ElementList els() => querySelectorAll('.dart');
}
String str = ' (${'parameter' + 'zxc'})';
String str = " (${true ? 2 + 2 / 2 : null})";
String str = r'\nraw\';
String str = r"\nraw\";
var str = '''
Something ${2+3}
''';
var str = r"""
Something ${2+3}
""";
</code></pre>
<h2>Delphi</h2>
<pre><code class="delphi">TList = Class(TObject)
Private
Some: String;
Public
Procedure Inside; // Suxx
End;{TList}
Procedure CopyFile(InFileName, var OutFileName: String);
Const
BufSize = 4096; (* Huh? *)
Var
InFile, OutFile: TStream;
Buffer: Array[1..BufSize] Of Byte;
ReadBufSize: Integer;
Begin
InFile := Nil;
OutFile := Nil;
Try
InFile := TFileStream.Create(InFileName, fmOpenRead);
OutFile := TFileStream.Create(OutFileName, fmCreate);
Repeat
ReadBufSize := InFile.Read(Buffer, BufSize);
OutFile.Write(Buffer, ReadBufSize);
Until ReadBufSize<>BufSize;
Log('File ''' + InFileName + ''' copied'#13#10);
Finally
InFile.Free;
OutFile.Free;
End;{Try}
End;{CopyFile}
</code></pre>
<h2>Diff</h2>
<pre><code class="diff">Index: languages/ini.js
===================================================================
--- languages/ini.js (revision 199)
+++ languages/ini.js (revision 200)
@@ -1,8 +1,7 @@
hljs.LANGUAGES.ini =
{
case_insensitive: true,
- defaultMode:
- {
+ defaultMode: {
contains: ['comment', 'title', 'setting'],
illegal: '[^\\s]'
},
*** /path/to/original timestamp
--- /path/to/new timestamp
***************
*** 1,3 ****
--- 1,9 ----
+ This is an important
+ notice! It should
+ therefore be located at
+ the beginning of this
+ document!
! compress the size of the
! changes.
It is important to spell
</code></pre>
<h2>Django</h2>
<pre><code class="django">{% if articles|length %}
{% for article in articles %}
{# Striped table #}
<tr class="{% cycle odd,even %}">
<td>{{ article|default:"Hi... "|escape }}</td>
<td {% if article.today %}class="today"{% endif %}>{{ article.date|date:'d.m.Y' }}</td>
</tr>
{% endfor %}
{% endif %}
{% comment %}
Comments may be long and multiline.
Markup is <em>not</em> highlighted within comments.
{% endcomment %}
</code></pre>
<h2>Dockerfile</h2>
<pre><code class="dockerfile"># Example instructions from https://docs.docker.com/reference/builder/
FROM ubuntu:14.04
MAINTAINER [email protected]
ENV foo /bar
WORKDIR ${foo} # WORKDIR /bar
ADD . $foo # ADD . /bar
COPY \$foo /quux # COPY $foo /quux
RUN apt-get update && apt-get install -y software-properties-common\
zsh curl wget git htop\
unzip vim telnet
RUN ["/bin/bash", "-c", "echo hello ${USER}"]
CMD ["executable","param1","param2"]
CMD command param1 param2
EXPOSE 1337
ENV myName="John Doe" myDog=Rex\ The\ Dog \
myCat=fluffy
ENV myName John Doe
ENV myDog Rex The Dog
ENV myCat fluffy
ADD hom* /mydir/ # adds all files starting with "hom"
ADD hom?.txt /mydir/ # ? is replaced with any single character
COPY hom* /mydir/ # adds all files starting with "hom"
COPY hom?.txt /mydir/ # ? is replaced with any single character
ENTRYPOINT ["executable", "param1", "param2"]
ENTRYPOINT command param1 param2
VOLUME ["/data"]
USER daemon
WORKDIR /path/to/workdir
ONBUILD ADD . /app/src
</code></pre>
<h2>DOS .bat</h2>
<pre><code class="dos">cd \
copy a b
ping 192.168.0.1
@rem ping 192.168.0.1
net stop sharedaccess
del %tmp% /f /s /q
del %temp% /f /s /q
ipconfig /flushdns
taskkill /F /IM JAVA.EXE /T
cd Photoshop/Adobe Photoshop CS3/AMT/
if exist application.sif (
ren application.sif _application.sif
) else (
ren _application.sif application.sif
)
taskkill /F /IM proquota.exe /T
sfc /SCANNOW
set path = test
xcopy %1\*.* %2
</code></pre>
<h2>Dust</h2>
<pre><code class="dust"><h3>Hours</h3>
<ul>
{#users}
<li {hello}}>{firstName}</li>{~n}
{/users}
</ul>
</code></pre>
<h2>Elixir</h2>
<pre><code class="elixir">defrecord Person, first_name: nil, last_name: "Dudington" do
def name record do # huh ?
"#{record.first_name} #{record.last_name}"
end
end
defrecord User, name: "José", age: 25
guy = Person.new first_name: "Guy"
guy.name
defmodule ListServer do
@moduledoc """
This module provides an easy to use ListServer, useful for keeping
lists of things.
"""
use GenServer.Behaviour
alias Foo.Bar
### Public API
@doc """
Starts and links a new ListServer, returning {:ok, pid}
## Example
iex> {:ok, pid} = ListServer.start_link
"""
def start_link do
:gen_server.start_link({:local, :list}, __MODULE__, [], [])
end
### GenServer API
def init(list) do
{:ok, list}
end
# Clear the list
def handle_cast :clear, list do
{:noreply, []}
end
end
{:ok, pid} = ListServer.start_link
pid <- {:foo, "bar"}
greeter = fn(x) -> IO.puts "hey #{x}" end
greeter.("Bob")
</code></pre>
<h2>ERB (Embedded Ruby)</h2>
<pre><code class="erb"><%# this is a comment %>
<% @posts.each do |post| %>
<p><%= link_to post.title, post %></p>
<% end %>
<%- available_things = things.select(&:available?) -%>
<%%- x = 1 + 2 -%%>
<%% value = 'real string #{@value}' %%>
<%%= available_things.inspect %%>
</code></pre>
<h2>Erlang REPL</h2>
<pre><code class="erlang-repl">1> Str = "abcd".
"abcd"
2> L = test:length(Str).
4
3> Descriptor = {L, list_to_atom(Str)}.
{4,abcd}
4> L.
4
5> b().
Descriptor = {4,abcd}
L = 4
Str = "abcd"
ok
6> f(L).
ok
7> b().
Descriptor = {4,abcd}
Str = "abcd"
ok
8> {L, _} = Descriptor.
{4,abcd}
9> L.
4
10> 2#101.
5
11> 1.85e+3.
1850
</code></pre>
<h2>Erlang</h2>
<pre><code class="erlang">-module(ssh_cli).
-behaviour(ssh_channel).
-include("ssh.hrl").
%% backwards compatibility
-export([listen/1, listen/2, listen/3, listen/4, stop/1]).
if L =/= [] -> % If L is not empty
sum(L) / count(L);
true ->
error
end.
%% state
-record(state, {
cm,
channel
}).
-spec foo(integer()) -> integer().
foo(X) -> 1 + X.
test(Foo)->Foo.
init([Shell, Exec]) ->
{ok, #state{shell = Shell, exec = Exec}};
init([Shell]) ->
false = not true,
io:format("Hello, \"~p!~n", [atom_to_list('World')]),
{ok, #state{shell = Shell}}.
concat([Single]) -> Single;
concat(RList) ->
EpsilonFree = lists:filter(
fun (Element) ->
case Element of
epsilon -> false;
_ -> true
end
end,
RList),