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 fr.songbird.survivalDevKit; | |
import java.io.*; | |
import net.wytrem.logging.*; | |
/** | |
* I'm happy to present you my primitive Corrector ! | |
* He can to correct words that your file contains ! (he's not case sensitive currently) | |
* @author songbird | |
* @version 0.4_2-ALPHA |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.scene.control.*?> | |
<?import java.lang.*?> | |
<?import javafx.scene.layout.*?> | |
<?import javafx.scene.layout.AnchorPane?> | |
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40"> | |
<children> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.geometry.*?> | |
<?import javafx.scene.control.*?> | |
<?import java.lang.*?> | |
<?import javafx.scene.layout.*?> | |
<?import javafx.scene.layout.AnchorPane?> | |
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.40"> |
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
ipAddress = "192.168.254.255" | |
if ipAddress =~ /^([0-9]{1,3}\.){3}[0-9]{1,3}$/ixu | |
puts "it run" #=> it run | |
end | |
ipAddress = "192...168..224.36" | |
if ipAddress =~ /^([0-9]{1,3}\.){3}[0-9]{1,3}$/ixu | |
puts "it run" #=> nil |
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
path = "/my/awesome/path/file" | |
puts path =~ /^((\/[a-zA-Z0-9_-]+)\/?)+$/ # => 0 it's ok | |
path = "/////////////" | |
puts path =~ /^((\/[a-zA-Z0-9_-]+)\/?)+$/ # => nil error |
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
path = "../my/path/file/" | |
puts path =~ /^(\.{2}\/)?([\w\d!?_-]\/?)+/ #=> 0 | |
path = "my/awesome/path/file" | |
puts path =~ /^(\.{2}\/)?([\w\d!?_-]\/?)+/ #=> 0 |
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
/* | |
Creates a new string if the pattern is found. | |
*/ | |
function splitter(pattern, target) { | |
var array_length = pattern.length; | |
var tmp = null; | |
for (var i = 0; i < array_length; i++) { | |
if (tmp != null) | |
tmp += pattern[i]; | |
if (tmp === null) |
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
function sliceAt(initial_string: string, target: string) | |
{ | |
let index : number = initial_string.indexOf(target); | |
if(index !== -1) | |
{ | |
switch(index) | |
{ | |
case 0:return initial_string.substring(index+target.length); | |
case (initial_string.length - 1): return initial_string.substring(index, target.length-1); |
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
/* | |
let foo : string = 'Hello world !'; | |
console.log(replace_word(foo, 'world', 'my name is John')); // print Hello my name is John ! | |
*/ | |
function replace_word(initial_string : string, word : string, newWord: string) : string | |
{ | |
let newString : string = ''; | |
const index : number = initial_string.indexOf(word); | |
if(index !== -1) |
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
function replace_word(initial_string, word, newWord) { | |
var index = initial_string.indexOf(word); | |
if (index !== -1) { | |
var first_part = ''; | |
var mid_part = ''; | |
var second_part = ''; | |
if (index === 0) { | |
first_part = newWord; | |
second_part = sliceAt(initial_string, word); | |
return "" + first_part + second_part; |
OlderNewer