This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// http://play.golang.org/p/jZ5pa944O1 <- will not display the colors | |
import "fmt" | |
const ( | |
InfoColor = "\033[1;34m%s\033[0m" | |
NoticeColor = "\033[1;36m%s\033[0m" | |
WarningColor = "\033[1;33m%s\033[0m" | |
ErrorColor = "\033[1;31m%s\033[0m" | |
DebugColor = "\033[0;36m%s\033[0m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
) | |
type To []string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$mode objfpc}{$M+} | |
program test; | |
type | |
TMyClass = class | |
procedure SayHi; | |
end; | |
procedure TMyClass.SayHi; | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
fmt.Println("Times: ") | |
t := time.Now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.prefixes(character varying) RETURNS character varying[] | |
LANGUAGE sql IMMUTABLE | |
AS $_$ | |
SELECT ARRAY(SELECT substring($1 FROM 1 FOR i) | |
FROM generate_series(1, GREATEST(length($1))) g(i))::varchar[]; | |
$_$ | |
SELECT MAX(prefix) FROM MY_TABLE WHERE prefix=ANY(content); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fd = inotify_init(); | |
$watch_descriptor = inotify_add_watch($fd, './watch', IN_CLOSE_WRITE); | |
while (true) { | |
$events = inotify_read($fd); | |
foreach ($events as $event) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
while (!feof(STDIN)) { | |
$f = fgets(STDIN); | |
if ($f) { | |
echo ">> $f\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
queue = Queue.new | |
threads = [] | |
1.step(1000) do |i| | |
queue << i | |
end | |
8.times do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
t, _ := time.Parse("2006-01-02 15:04", "2021-05-17 10:55") | |
today := t.Weekday() |
NewerOlder