fork
This commit is contained in:
8
util/sample/abap.txt
Normal file
8
util/sample/abap.txt
Normal file
@ -0,0 +1,8 @@
|
||||
* A sample function
|
||||
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
|
||||
EXPORTING
|
||||
MASK = ',*.txt,*.*'
|
||||
STATIC = 'X'
|
||||
CHANGING
|
||||
FILE_NAME = LV_FILE.
|
||||
|
3
util/sample/apache.txt
Normal file
3
util/sample/apache.txt
Normal file
@ -0,0 +1,3 @@
|
||||
RewriteEngine On
|
||||
RewriteCond %{DOCUMENT_ROOT}/cache%{REQUEST_URI}.html -f
|
||||
RewriteRule ^(.*)$ /cache/$1.html [QSA,L]
|
10
util/sample/applescript.txt
Normal file
10
util/sample/applescript.txt
Normal file
@ -0,0 +1,10 @@
|
||||
-- Dialog
|
||||
set dialogReply to display dialog
|
||||
"Dialog Text" default answer
|
||||
"Text Answer" hidden answer false
|
||||
buttons {"Skip", "Okay", "Cancel"}
|
||||
default button
|
||||
"Okay" cancel button
|
||||
"Skip" with title
|
||||
"Dialog Window Title" with icon note
|
||||
giving up after 20
|
12
util/sample/arduino.txt
Normal file
12
util/sample/arduino.txt
Normal file
@ -0,0 +1,12 @@
|
||||
#define LED_PIN 13
|
||||
|
||||
void setup () {
|
||||
pinMode (LED_PIN, OUTPUT); // enable pin 13 for digital output
|
||||
}
|
||||
|
||||
void loop () {
|
||||
digitalWrite (LED_PIN, HIGH); // turn on the LED
|
||||
delay (1000); // wait one second (1000 milliseconds)
|
||||
digitalWrite (LED_PIN, LOW); // turn off the LED
|
||||
delay (1000); // wait one second
|
||||
}
|
9
util/sample/as.txt
Normal file
9
util/sample/as.txt
Normal file
@ -0,0 +1,9 @@
|
||||
class com.example.Greeter extends MovieClip
|
||||
{
|
||||
public function Greeter() {}
|
||||
public function onLoad():Void
|
||||
{
|
||||
var txtHello:TextField = this.createTextField("txtHello", 0, 0, 0, 100, 100);
|
||||
txtHello.text = "Hello, world";
|
||||
}
|
||||
}
|
5
util/sample/asm.txt
Normal file
5
util/sample/asm.txt
Normal file
@ -0,0 +1,5 @@
|
||||
mov eax, [ebx] ; Move the 4 bytes in memory at the address contained in EBX into EAX
|
||||
mov [var], ebx ; Move the contents of EBX into the 4 bytes at memory address var. (Note, var is a 32-bit constant).
|
||||
mov eax, [esi-4] ; Move 4 bytes at memory address ESI + (-4) into EAX
|
||||
mov [esi+eax], cl ; Move the contents of CL into the byte at address ESI+EAX
|
||||
mov edx, [esi+4*ebx] ; Move the 4 bytes of data at address ESI+4*EBX into EDX
|
7
util/sample/asp.txt
Normal file
7
util/sample/asp.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Set FS=Server.CreateObject("Scripting.FileSystemObject")
|
||||
Set RS=FS.OpenTextFile(Server.MapPath("counter.txt"), 1, False)
|
||||
fcount=RS.ReadLine
|
||||
RS.Close
|
||||
fcount=fcount+1
|
||||
Set RS=Nothing
|
||||
Set FS=Nothing
|
11
util/sample/autoit.txt
Normal file
11
util/sample/autoit.txt
Normal file
@ -0,0 +1,11 @@
|
||||
;Finds the average of numbers specified by a user.
|
||||
;The numbers must be delimited by commas.
|
||||
#NoTrayIcon
|
||||
#include <GUIConstantsEx.au3>
|
||||
#include <Array.au3>
|
||||
;region---------------GUI-----------------------
|
||||
$form = GUICreate("Average Finder", 300, 100)
|
||||
$label = GUICtrlCreateLabel("Enter the numbers to be averaged separated by commas", 19, 0)
|
||||
$textbox = GUICtrlCreateInput("", 20, 20, 220)
|
||||
GUISetState()
|
||||
;endregion---------------END GUI-----------------------
|
11
util/sample/batch.txt
Normal file
11
util/sample/batch.txt
Normal file
@ -0,0 +1,11 @@
|
||||
if [%3]==[] (
|
||||
goto :usage
|
||||
)
|
||||
if not exist %3 (
|
||||
echo Creating %3 dir...
|
||||
mkdir %3
|
||||
)
|
||||
echo Copying original files to %3 dir...
|
||||
copy %2\* %3 >nul
|
||||
echo Adding background...
|
||||
mogrify -background #%1 -flatten %3\*
|
10
util/sample/c#.txt
Normal file
10
util/sample/c#.txt
Normal file
@ -0,0 +1,10 @@
|
||||
using Functions;
|
||||
class FunctionClient {
|
||||
public static void Main(string[] args) {
|
||||
Console.WriteLine("Function Client");
|
||||
if ( args.Length == 0 ) {
|
||||
Console.WriteLine("Usage: FunctionTest ... ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
16
util/sample/c++.txt
Normal file
16
util/sample/c++.txt
Normal file
@ -0,0 +1,16 @@
|
||||
#include <fstream.h>
|
||||
|
||||
void main () {
|
||||
ifstream f1;
|
||||
ofstream f2;
|
||||
f1.open("scores.96");
|
||||
f2.open("final.96");
|
||||
|
||||
int s1, s2, s3;
|
||||
float w1, w2, w3;
|
||||
|
||||
f1 >> s1 >> w1;
|
||||
f1 >> s2 >> w2;
|
||||
f1 >> s3 >> w3;
|
||||
f2 << (s1*w1+s2*w2+s3*w3);
|
||||
}
|
9
util/sample/c.txt
Normal file
9
util/sample/c.txt
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
int main(void) {
|
||||
int x;
|
||||
x = 0;
|
||||
// Uses a pointer
|
||||
set(&x, 42);
|
||||
printf("%d %d", x);
|
||||
return 0;
|
||||
}
|
5
util/sample/clojure.txt
Normal file
5
util/sample/clojure.txt
Normal file
@ -0,0 +1,5 @@
|
||||
(defn keyword-params-request
|
||||
"Converts string keys in :params map to keywords. See: wrap-keyword-params."
|
||||
{:added "1.2"}
|
||||
[request]
|
||||
(update-in request [:params] keyify-params))
|
14
util/sample/coffee.txt
Normal file
14
util/sample/coffee.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Example Script
|
||||
|
||||
class Animal
|
||||
constructor: (@name) ->
|
||||
|
||||
move: (meters) ->
|
||||
alert @name + " moved #{meters}m."
|
||||
alert @name.foo
|
||||
alert this.name
|
||||
|
||||
class Snake extends Animal
|
||||
move: ->
|
||||
alert "Slithering..."
|
||||
super 5
|
12
util/sample/css.txt
Normal file
12
util/sample/css.txt
Normal file
@ -0,0 +1,12 @@
|
||||
@import url('fonts/monaco/monaco.css');
|
||||
|
||||
/* General ========================= */
|
||||
.crayon-syntax {
|
||||
overflow: hidden !important;
|
||||
position: relative !important;
|
||||
}
|
||||
|
||||
.crayon-syntax .crayon-toolbar {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
8
util/sample/default.txt
Normal file
8
util/sample/default.txt
Normal file
@ -0,0 +1,8 @@
|
||||
// A sample class
|
||||
class Human {
|
||||
private int age = 0;
|
||||
public void birthday() {
|
||||
age++;
|
||||
print('Happy Birthday!');
|
||||
}
|
||||
}
|
9
util/sample/delphi.txt
Normal file
9
util/sample/delphi.txt
Normal file
@ -0,0 +1,9 @@
|
||||
type
|
||||
THelloWorld = class
|
||||
procedure Put;
|
||||
end;
|
||||
|
||||
procedure THelloWorld.Put;
|
||||
begin
|
||||
Writeln('Hello, World!');
|
||||
end;
|
9
util/sample/diff.txt
Normal file
9
util/sample/diff.txt
Normal file
@ -0,0 +1,9 @@
|
||||
*** testing ***
|
||||
It is important to spell
|
||||
--- testing ---
|
||||
-check this dokument. On
|
||||
+check this document. On
|
||||
the other hand, a
|
||||
! misspelled word isn't
|
||||
the end of the world.
|
||||
@@ -22,3 +22,7 @@
|
13
util/sample/dws.txt
Normal file
13
util/sample/dws.txt
Normal file
@ -0,0 +1,13 @@
|
||||
type
|
||||
THelloWorld = class
|
||||
procedure Put; // you can also implement out of line
|
||||
begin
|
||||
PrintLn('Hello, World!');
|
||||
end
|
||||
end;
|
||||
|
||||
var HelloWorld := new THelloWorld; // strong typing, inferred
|
||||
|
||||
HelloWorld.Put;
|
||||
|
||||
// no need to release objects thanks to automatic memory management
|
12
util/sample/erlang.txt
Normal file
12
util/sample/erlang.txt
Normal file
@ -0,0 +1,12 @@
|
||||
%% qsort:qsort(List)
|
||||
%% Sort a list of items
|
||||
-module(qsort). % This is the file 'qsort.erl'
|
||||
-export([qsort/1]). % A function 'qsort' with 1 parameter is exported (no type, no name)
|
||||
|
||||
qsort([]) -> []; % If the list [] is empty, return an empty list (nothing to sort)
|
||||
qsort([Pivot|Rest]) ->
|
||||
% Compose recursively a list with 'Front' for all elements that should be before 'Pivot'
|
||||
% then 'Pivot' then 'Back' for all elements that should be after 'Pivot'
|
||||
qsort([Front || Front <- Rest, Front < Pivot])
|
||||
++ [Pivot] ++
|
||||
qsort([Back || Back <- Rest, Back >= Pivot]).
|
11
util/sample/go.txt
Normal file
11
util/sample/go.txt
Normal file
@ -0,0 +1,11 @@
|
||||
package geometry
|
||||
import "math"
|
||||
// Test functions
|
||||
func add(a, b int) int { return a + b }
|
||||
func (self *Point) Scale(factor float64) {
|
||||
self.setX(self.x * factor)
|
||||
self.setY(self.y * factor)
|
||||
}
|
||||
type Writer interface {
|
||||
Write(p []byte) (n int, err os.Error)
|
||||
}
|
23
util/sample/haskell.txt
Normal file
23
util/sample/haskell.txt
Normal file
@ -0,0 +1,23 @@
|
||||
module Interpret(interpret) where
|
||||
|
||||
import Prog
|
||||
|
||||
import System.IO.Unsafe
|
||||
import Control.Monad
|
||||
import Char
|
||||
|
||||
-- In a call to this function such as "interpret prog vars entry debug":
|
||||
-- prog is the ABCD program to be interpreted;
|
||||
-- vars represents the initial values of the four variables;
|
||||
-- entry is the name of the entry point function, "main" by default; and
|
||||
-- debug specifies whether the user wants debugging output.
|
||||
|
||||
interpret :: Prog -> Vars -> String -> MaybeDebug -> IO ()
|
||||
interpret prog vars entry debug = do
|
||||
let context = Context prog vars entry debug 0
|
||||
let newContext = runFunc entry context
|
||||
let output =
|
||||
case newContext of
|
||||
IError s -> "abcdi: " ++ s
|
||||
IOK c -> (strVal (getVar A (cVars c))) ++ "\n"
|
||||
putStrLn output
|
10
util/sample/ilogic.txt
Normal file
10
util/sample/ilogic.txt
Normal file
@ -0,0 +1,10 @@
|
||||
Dim map As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
|
||||
map.Add("Arg1", "Arg1Value")
|
||||
iLogicVb.RunRule("ruleName", map)
|
||||
iLogicVb.RunRule("PartA:1", "ruleName")
|
||||
InventorVb.RunMacro("projectName", "moduleName", "macroName")
|
||||
AddVbRule "RuleName"
|
||||
AddReference "fileName.dll"
|
||||
AddVbFile "fileName.vb"
|
||||
AddResources "fileName.resources"
|
||||
arg1Value = RuleArguments("Arg1")
|
10
util/sample/ini.txt
Normal file
10
util/sample/ini.txt
Normal file
@ -0,0 +1,10 @@
|
||||
; last modified 1 April 2001 by John Doe
|
||||
[owner]
|
||||
name=John Doe
|
||||
organization=Acme Widgets Inc.
|
||||
|
||||
[database]
|
||||
; use IP address in case network name resolution is not working
|
||||
server=192.0.2.62
|
||||
port=143
|
||||
file="payroll.dat"
|
8
util/sample/java.txt
Normal file
8
util/sample/java.txt
Normal file
@ -0,0 +1,8 @@
|
||||
// A sample class
|
||||
class Human extends Mammal implements Humanoid {
|
||||
private int age = 0;
|
||||
public void birthday() {
|
||||
age++;
|
||||
System.out.println('Happy Birthday!');
|
||||
}
|
||||
}
|
12
util/sample/js.txt
Normal file
12
util/sample/js.txt
Normal file
@ -0,0 +1,12 @@
|
||||
// Convert '-10px' to -10
|
||||
function px_to_int(pixels) {
|
||||
if (typeof pixels != 'string') {
|
||||
return 0;
|
||||
}
|
||||
var result = pixels.replace(/[^-0-9]/g, '');
|
||||
if (result.length == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return parseInt(result);
|
||||
}
|
||||
}
|
18
util/sample/kl.txt
Normal file
18
util/sample/kl.txt
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Swirley Movement OP KL Example
|
||||
*/
|
||||
|
||||
require Math;
|
||||
|
||||
operator swirleyMovementOp(
|
||||
Scalar seconds,
|
||||
Index id,
|
||||
Xfo baseXfo,
|
||||
io Xfo xfo
|
||||
) {
|
||||
xfo.tr = baseXfo.tr + Vec3(sin((seconds * 2.3) + (id * 3.2)) * 3.0, cos(seconds * 4.30) * 3.0, 0.0);
|
||||
|
||||
// The following line will log a message to the console...
|
||||
// report("swirleyMovementOp :" + xfo.tr);
|
||||
}
|
||||
|
13
util/sample/less.txt
Normal file
13
util/sample/less.txt
Normal file
@ -0,0 +1,13 @@
|
||||
@import "lib.css";
|
||||
@the-border: 1px;
|
||||
@base-color: #111;
|
||||
@red: #842210;
|
||||
#header {
|
||||
color: (@base-color * 3);
|
||||
border-left: @the-border;
|
||||
border-right: (@the-border * 2);
|
||||
}
|
||||
#footer {
|
||||
color: (@base-color + #003300);
|
||||
border-color: desaturate(@red, 10%);
|
||||
}
|
12
util/sample/lisp.txt
Normal file
12
util/sample/lisp.txt
Normal file
@ -0,0 +1,12 @@
|
||||
;Coding starts here
|
||||
(defun c:lg ( / x_object x_length)
|
||||
(vl-load-com)
|
||||
(setq x_object (entsel))
|
||||
(setq x_object (vlax-Ename->Vla-Object (car x_object)))
|
||||
(setq x_length (vlax-curve-getdistatparam x_object
|
||||
(vlax-curve-getendparam x_object )))
|
||||
(alert (strcat "Length = " (rtos x_length)))
|
||||
(princ)
|
||||
);defun
|
||||
(princ)
|
||||
;Coding ends here
|
7
util/sample/lua.txt
Normal file
7
util/sample/lua.txt
Normal file
@ -0,0 +1,7 @@
|
||||
fibs = { 1, 1 } -- Initial values for fibs[1] and fibs[2].
|
||||
setmetatable(fibs, {
|
||||
__index = function(name, n) -- Call this function if fibs[n] does not exist.
|
||||
name[n] = name[n - 1] + name[n - 2] -- Calculate and memoize fibs[n].
|
||||
return name[n]
|
||||
end
|
||||
})
|
9
util/sample/matlab.txt
Normal file
9
util/sample/matlab.txt
Normal file
@ -0,0 +1,9 @@
|
||||
clear
|
||||
N = input('Give numerator: ');
|
||||
D = input('Give denominator: ');
|
||||
|
||||
if D==0
|
||||
'Sorry, cannot divide by zero'
|
||||
else
|
||||
ratio = N/D
|
||||
end
|
24
util/sample/mel.txt
Normal file
24
util/sample/mel.txt
Normal file
@ -0,0 +1,24 @@
|
||||
// Code starts here
|
||||
global proc human(int $age){
|
||||
string $ageExt;
|
||||
$age++;
|
||||
|
||||
if($age == 0){
|
||||
$ageExt = "th";
|
||||
}else if($age == 1){
|
||||
$ageExt = "st";
|
||||
}else if($age == 2){
|
||||
$ageExt = "nd";
|
||||
}else{
|
||||
$ageExt = "th";
|
||||
}
|
||||
|
||||
print("Happy " + $age + $ageExt + " Birthday!\n");
|
||||
}
|
||||
|
||||
|
||||
int $i=0;
|
||||
for($i=0;$i<=99;$i+=1){
|
||||
human($i);
|
||||
}
|
||||
|
8
util/sample/monkey.txt
Normal file
8
util/sample/monkey.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Class GameApp Extends App
|
||||
Field player:Player
|
||||
Method OnCreate:Int()
|
||||
local img:Image = LoadImage("player.png")
|
||||
player = New Player(img, 100, 100)
|
||||
SetUpdateRate 60
|
||||
End
|
||||
End
|
8
util/sample/mysql.txt
Normal file
8
util/sample/mysql.txt
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE shop (
|
||||
article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,
|
||||
dealer CHAR(20) DEFAULT '' NOT NULL,
|
||||
price DOUBLE(16,2) DEFAULT '0.00' NOT NULL,
|
||||
PRIMARY KEY(article, dealer));
|
||||
INSERT INTO shop VALUES
|
||||
(1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),
|
||||
(3,'C',1.69),(3,'D',1.25),(4,'D',19.95);
|
8
util/sample/objc.txt
Normal file
8
util/sample/objc.txt
Normal file
@ -0,0 +1,8 @@
|
||||
#import <objc/Object.h>
|
||||
@interface Forwarder : Object {
|
||||
id recipient; // The object we want to forward the message to.
|
||||
}
|
||||
// Accessor methods.
|
||||
- (id) recipient;
|
||||
- (id) setRecipient:(id)_recipient;
|
||||
@end
|
14
util/sample/perl.txt
Normal file
14
util/sample/perl.txt
Normal file
@ -0,0 +1,14 @@
|
||||
while (<STDIN>) {
|
||||
$oldStr = $_;
|
||||
foreach $k (keys %dic) {
|
||||
s/$k/$dic{$k}/g;
|
||||
}
|
||||
|
||||
$newStr = $_;
|
||||
if ($oldStr ne $newStr) {
|
||||
print STDERR "\n";
|
||||
print STDERR "old>>$oldStr";
|
||||
print STDERR "new>>$newStr";
|
||||
}
|
||||
print;
|
||||
}
|
8
util/sample/pgsql.txt
Normal file
8
util/sample/pgsql.txt
Normal file
@ -0,0 +1,8 @@
|
||||
CREATE TABLE arr(f1 int[], f2 int[]);
|
||||
INSERT INTO arr VALUES (ARRAY[[1,2],[3,4]], ARRAY[[5,6],[7,8]]);
|
||||
SELECT ARRAY[f1, f2, '{{9,10},{11,12}}'::int[]] FROM arr;
|
||||
array_prepend(1, ARRAY[2,3])
|
||||
SELECT ROW(table.*) IS NULL FROM table; -- detect all-null rows
|
||||
SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype));
|
||||
|
||||
CHARACTER VARYING
|
10
util/sample/php.txt
Normal file
10
util/sample/php.txt
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
// A sample class
|
||||
class Human {
|
||||
$age = 0;
|
||||
function birthday() {
|
||||
$age++;
|
||||
echo 'Happy Birthday!';
|
||||
}
|
||||
}
|
||||
?>
|
11
util/sample/plsql.txt
Normal file
11
util/sample/plsql.txt
Normal file
@ -0,0 +1,11 @@
|
||||
DECLARE
|
||||
number1 NUMBER(2);
|
||||
number2 number1%TYPE := 17; -- value default
|
||||
text1 VARCHAR2(12) := 'Hello world';
|
||||
text2 DATE := SYSDATE; -- current date and time
|
||||
BEGIN
|
||||
SELECT street_number
|
||||
INTO number1
|
||||
FROM address
|
||||
WHERE name = 'INU';
|
||||
END;
|
2
util/sample/ps.txt
Normal file
2
util/sample/ps.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# Find the processes that use more than 1000 MB of memory and kill them
|
||||
Get-Process | Where-Object { $_.WS -gt 1000MB } | Stop-Process
|
9
util/sample/python.txt
Normal file
9
util/sample/python.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# Merge example
|
||||
def mergeWithoutOverlap(oneDict, otherDict):
|
||||
newDict = oneDict.copy()
|
||||
for key in otherDict.keys():
|
||||
if key in oneDict.keys():
|
||||
raise ValueError, "the two dictionaries are sharing keys!"
|
||||
newDict[key] = otherDict[key]
|
||||
return newDict
|
||||
|
14
util/sample/r.txt
Normal file
14
util/sample/r.txt
Normal file
@ -0,0 +1,14 @@
|
||||
library(caTools) # external package providing write.gif function
|
||||
jet.colors <- colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F",
|
||||
"yellow", "#FF7F00", "red", "#7F0000"))
|
||||
m <- 1200 # define size
|
||||
C <- complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
|
||||
imag=rep(seq(-1.2,1.2, length.out=m), m ) )
|
||||
C <- matrix(C,m,m) # reshape as square matrix of complex numbers
|
||||
Z <- 0 # initialize Z to zero
|
||||
X <- array(0, c(m,m,20)) # initialize output 3D array
|
||||
for (k in 1:20) { # loop with 20 iterations
|
||||
Z <- Z^2+C # the central difference equation
|
||||
X[,,k] <- exp(-abs(Z)) # capture results
|
||||
}
|
||||
write.gif(X, "Mandelbrot.gif", col=jet.colors, delay=100)
|
7
util/sample/reg.txt
Normal file
7
util/sample/reg.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft]
|
||||
"Value A"="<String value data>"
|
||||
"Value B"=hex:<Binary data (as comma-delimited list of hexadecimal values)>
|
||||
"Value C"=dword:<DWORD value integer>
|
||||
"Value D"=hex(7):<Multi-string value data (as comma-delimited list of hexadecimal values)>
|
||||
"Value E"=hex(2):<Expandable string value data (as comma-delimited list of hexadecimal values)>
|
9
util/sample/ruby.txt
Normal file
9
util/sample/ruby.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# 'w' denotes "write mode".
|
||||
File.open('file.txt', 'w') do |file|
|
||||
file.puts 'Wrote some text.'
|
||||
end # File is automatically closed here
|
||||
|
||||
File.readlines('file.txt').each do |line|
|
||||
puts line
|
||||
end
|
||||
# => Wrote some text.
|
8
util/sample/rust.txt
Normal file
8
util/sample/rust.txt
Normal file
@ -0,0 +1,8 @@
|
||||
/* The branches in this function exhibit Rust's optional implicit return
|
||||
values, which can be utilized where a more "functional" style is preferred.
|
||||
Unlike C++ and related languages, Rust's `if` construct is an expression
|
||||
rather than a statement, and thus has a return value of its own. */
|
||||
fn recursive_factorial(n: int) -> int {
|
||||
if n <= 1 { 1 }
|
||||
else { n * recursive_factorial(n-1) }
|
||||
}
|
11
util/sample/sass.txt
Normal file
11
util/sample/sass.txt
Normal file
@ -0,0 +1,11 @@
|
||||
@mixin adjust-location($x, $y) {
|
||||
@if unitless($x) {
|
||||
@warn "Assuming #{$x} to be in pixels";
|
||||
$x: 1px * $x;
|
||||
}
|
||||
@if unitless($y) {
|
||||
@warn "Assuming #{$y} to be in pixels";
|
||||
$y: 1px * $y;
|
||||
}
|
||||
position: relative; left: $x; top: $y;
|
||||
}
|
15
util/sample/scala.txt
Normal file
15
util/sample/scala.txt
Normal file
@ -0,0 +1,15 @@
|
||||
// A sample class
|
||||
object Newton extends App {
|
||||
|
||||
def EPS = 1e-5
|
||||
|
||||
def sqrt(x: Double): Double = {
|
||||
def loop(y: Double): Double =
|
||||
if (math.abs(y * y - x) > EPS) loop(((x / y) + y) / 2.0)
|
||||
else y
|
||||
|
||||
loop(1.0)
|
||||
}
|
||||
|
||||
println(sqrt(2.0)) // 1.41
|
||||
}
|
6
util/sample/scheme.txt
Normal file
6
util/sample/scheme.txt
Normal file
@ -0,0 +1,6 @@
|
||||
(define var "goose")
|
||||
;; Any reference to var here will be bound to "goose"
|
||||
(let* ((var1 10)
|
||||
(var2 (+ var1 12)))
|
||||
;; But the definition of var1 could not refer to var2
|
||||
)
|
12
util/sample/sh.txt
Normal file
12
util/sample/sh.txt
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
for jpg in "$@" ; do
|
||||
png="${jpg%.jpg}.png"
|
||||
echo converting "$jpg" ...
|
||||
if convert "$jpg" jpg.to.png ; then
|
||||
mv jpg.to.png "$png"
|
||||
else
|
||||
echo 'error: failed output saved in "jpg.to.png".' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo all conversions successful
|
7
util/sample/swift.txt
Normal file
7
util/sample/swift.txt
Normal file
@ -0,0 +1,7 @@
|
||||
class Human {
|
||||
var age = 0
|
||||
func birthday() {
|
||||
age++;
|
||||
println('Happy Birthday!');
|
||||
}
|
||||
}
|
5
util/sample/tex.txt
Normal file
5
util/sample/tex.txt
Normal file
@ -0,0 +1,5 @@
|
||||
\begin{document}
|
||||
\hello % Here a comment
|
||||
% Here a comment from line beginning
|
||||
|
||||
10\% is not a comment.
|
4
util/sample/tsql.txt
Normal file
4
util/sample/tsql.txt
Normal file
@ -0,0 +1,4 @@
|
||||
IF DATEPART(dw, GETDATE()) = 7 OR DATEPART(dw, GETDATE()) = 1
|
||||
PRINT 'It is the weekend.'
|
||||
ELSE
|
||||
PRINT 'It is a weekday.'
|
10
util/sample/vb.txt
Normal file
10
util/sample/vb.txt
Normal file
@ -0,0 +1,10 @@
|
||||
Option Explicit
|
||||
Dim Count As Integer
|
||||
Private Sub Form_Load()
|
||||
Count = 0
|
||||
Timer1.Interval = 1000 ' units of milliseconds
|
||||
End Sub
|
||||
Private Sub Timer1_Timer()
|
||||
Count = Count + 1
|
||||
lblCount.Caption = Count
|
||||
End Sub
|
8
util/sample/vbnet.txt
Normal file
8
util/sample/vbnet.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Imports System
|
||||
Module Module1
|
||||
'This program will display Hello World
|
||||
Sub Main()
|
||||
Console.WriteLine("Hello World")
|
||||
Console.ReadKey()
|
||||
End Sub
|
||||
End Module
|
12
util/sample/vim.txt
Normal file
12
util/sample/vim.txt
Normal file
@ -0,0 +1,12 @@
|
||||
"Toggle word checking on or off...
|
||||
function! WordCheck ()
|
||||
"Toggle the flag (or set it if it doesn't yet exist)...
|
||||
let w:check_words = exists('w:check_words') ? !w:check_words : 1
|
||||
|
||||
"Turn match mechanism on/off, according to new state of flag...
|
||||
if w:check_words
|
||||
exec s:words_matcher
|
||||
else
|
||||
match none
|
||||
endif
|
||||
endfunction
|
12
util/sample/xhtml.txt
Normal file
12
util/sample/xhtml.txt
Normal file
@ -0,0 +1,12 @@
|
||||
<body onload="loadpdf()">
|
||||
<p>This is an example of an
|
||||
<abbr title="Extensible HyperText Markup Language">XHTML</abbr> 1.0 Strict document.<br />
|
||||
<img id="validation-icon" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" /><br />
|
||||
<object id="pdf-object"
|
||||
name="pdf-object"
|
||||
type="application/pdf"
|
||||
data="http://www.w3.org/TR/xhtml1/xhtml1.pdf"
|
||||
width="100%"
|
||||
height="500">
|
||||
</object>
|
||||
</p>
|
7
util/sample/yaml.txt
Normal file
7
util/sample/yaml.txt
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
receipt: Oz-Ware Purchase Invoice
|
||||
date: 2007-08-06
|
||||
customer:
|
||||
given: "Dorothy"
|
||||
family: Gale
|
||||
...
|
20
util/sample/zsh.txt
Normal file
20
util/sample/zsh.txt
Normal file
@ -0,0 +1,20 @@
|
||||
parse_options()
|
||||
{
|
||||
o_port=(-p 9999)
|
||||
o_root=(-r WWW)
|
||||
o_log=(-d ZWS.log)
|
||||
|
||||
zparseopts -K -- p:=o_port r:=o_root l:=o_log h=o_help
|
||||
if [[ $? != 0 || "$o_help" != "" ]]; then
|
||||
echo Usage: $(basename "$0") "[-p PORT] [-r DIRECTORY]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
port=$o_port[2]
|
||||
root=$o_root[2]
|
||||
log=$o_log[2]
|
||||
|
||||
if [[ $root[1] != '/' ]]; then root="$PWD/$root"; fi
|
||||
}
|
||||
# now use the function:
|
||||
parse_options $*
|
Reference in New Issue
Block a user