This file contains hidden or 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
import text/regexp/[PCRE] | |
main: func | |
{ | |
regexp := PCRE new() .setPattern("#^http://([^/]+?)(/.+)$#i", 0) | |
if (regexp matches("http://www.google.fr/images?a=pika&b=chu")) | |
{ | |
"OK" println() | |
} |
This file contains hidden or 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 transliterate(my_text VARCHAR) RETURNS varchar AS $$ | |
DECLARE | |
text_out VARCHAR DEFAULT ''; | |
BEGIN | |
text_out := my_text; | |
text_out := translate(text_out, 'áàâäåáăąãāçċćčĉéèėëêēĕîïìíīñôöøõōùúüûūýÿỳ', 'aaaaaaaaaaccccceeeeeeeiiiiinooooouuuuuyyy'); | |
text_out := translate(text_out, 'ÁÀÂÄÅÁĂĄÃĀÇĊĆČĈÉÈĖËÊĒĔÎÏÌÍĪÑÔÖØÕŌÙÚÜÛŪÝŸỲ', 'AAAAAAAAAACCCCCEEEEEEEIIIIINOOOOOUUUUUYYY'); | |
text_out := replace(text_out, 'æ', 'ae'); | |
text_out := replace(text_out, 'Œ', 'OE'); | |
text_out := replace(text_out, 'Æ', 'AE'); |
This file contains hidden or 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 slugify(title VARCHAR) RETURNS varchar AS $$ | |
SELECT trim(both '-' from regexp_replace(lower(transliterate(title)), '[^a-z0-9]+', '-', 'g')); | |
$$ LANGUAGE sql IMMUTABLE; |
This file contains hidden or 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 cut_nicely(my_string VARCHAR, my_length INTEGER) RETURNS varchar AS $$ | |
DECLARE | |
my_pointer INTEGER; | |
BEGIN | |
my_pointer := my_length; | |
WHILE my_pointer < length(my_string) AND transliterate(substr(my_string, my_pointer, 1)) ~* '[a-z]' LOOP | |
my_pointer := my_pointer + 1; | |
END LOOP; | |
RETURN substr(my_string, 1, my_pointer); |
This file contains hidden or 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
use glade, gtk | |
import glade/XML | |
import gtk/Gtk | |
Calculette: class | |
{ | |
glade_ui : XML | |
init: func { | |
glade_ui = XML new("calculette.glade", "", "") .signalAutoConnect() |
This file contains hidden or 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
import structs/HashMap | |
ages := HashMap<String, Int> new() | |
ages["arthur"] = 2 | |
ages["john"] = 12 | |
ages["peter"] = 23 | |
ages["sarah"] = 24 | |
ages each(|a, b| "%s is %d years old." printfln(a, b)) |
This file contains hidden or 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
8404-3 "COMMUTATEUR 3C/4P" 07202 | |
JS511B "INV. 2P ON-ON 10A/250VAC" 07046 | |
BZ03001 "PRISE POLYSNAP 2P T RH" 08645 | |
RCAC2N "SOCLE RCA ISOLE NOIR RH" 08536 | |
F632-1.25A "FUSIBLE RAPIDE 6X32MM" 09369-1 | |
T18-10K "AJUSTABLE 15 TOURS RH" 04656 | |
RE5W330R "RESISTANCE BOBINEE 5W" 04342 | |
RE5W470R "RESISTANCE BOBINEE 5W" 04344 | |
100UF/350V "CONDENS. CHIMIQUE RADIAL" 04939 | |
10000U/63V "CONDENSATEUR METALLIQ. RH" 05046 |
This file contains hidden or 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 | |
class GhLoggerException extends RuntimeException | |
{ | |
} | |
class GhLogger | |
{ | |
const ERROR_LEVEL = 255; | |
const DEBUG = 1; |
This file contains hidden or 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
lint = "!sh -c 'git status | awk \"/modified/ {print \\$3}\" | xargs -L 1 php -l'" |
This file contains hidden or 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 is_email(email VARCHAR) RETURNS BOOLEAN AS $$ | |
BEGIN | |
RETURN email ~* '^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$'; | |
END; | |
$$ LANGUAGE plpgsql |
OlderNewer