Hello World !


JavaScript

1
console.log("Hello World");

这儿有一些代码示例~

Apache

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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>

Bash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

###### CONFIG
ACCEPTED_HOSTS="/root/.hag_accepted.conf"
BE_VERBOSE=false

if [ "$UID" -ne 0 ]
then
echo "Superuser rights required"
exit 2
fi

genApacheConf(){
echo -e "# Host ${HOME_DIR}$1/$2 :"
}

echo '"quoted"' | tr -d \" > text.txt

CoffeeScript

1
2
3
4
5
6
7
8
9
10
11
12
13
grade = (student, period=(if b? then 7 else 6)) ->
if student.excellentWork
"A+"
else if student.okayStuff
if student.triedHard then "B" else "B-"
else
"C"

class Animal extends Being
constructor: (@name) ->

move: (meters) ->
alert @name + " moved #{meters}m."

C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>

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;
}

C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.IO.Compression;

#pragma warning disable 414, 3021

namespace MyApplication
{
[Obsolete("...")]
class Program : IInterface
{
public static List<int> JustDoIt(int count)
{
Console.WriteLine($"Hello {Name}!");
return new List<int>(new int[] { 1, 2, 3 })
}
}
}

CSS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}

body, .usertext {
color: #F0F0F0; background: #600;
font-family: Chunkfive, sans;
--heading-1: 30px/32px Helvetica, sans-serif;
}

@import url(print.css);
@media print {
a[href^=http]::after {
content: attr(href)
}
}

diff

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
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

使用主题:Atom One Dark Reasonable
查看更多示例:Highlight.js demo

打赏
支付宝 | Alipay
微信 | Wechat