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
# The goal is to count the frequency of subsequent strings in a row. | |
def count_subsequent_str(str): | |
str = str.lower() | |
temp = {} | |
for i in range(len(str) - 1): | |
if not str[i] in temp: | |
temp[str[i]] = 0 | |
if str[i] == str[i+1] and temp[str[i]] < 1: | |
temp[str[i]] += 2 |
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
defmodule NxDiabetes do | |
@moduledoc """ | |
Documentation for `NxDiabetes`. | |
DataSet: | |
https://www.kaggle.com/uciml/pima-indians-diabetes-database | |
""" | |
alias NimbleCSV.RFC4180, as: CSV | |
require Axon |
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
(defn string-to-vector [x] | |
(clojure.string/split x #" ")) | |
(defn to-int [x] | |
(Integer/parseInt x)) | |
(defn divisible? [i j k] | |
(let [i (to-int i) | |
j (to-int j) | |
k (to-int k) |
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
(defn to-int [x] | |
(Integer/parseInt x)) | |
(defn string-to-vector [x] | |
(clojure.string/split x #" ")) | |
(def alice-points (atom 0)) | |
(def bob-points (atom 0)) | |
(defn counter [points] |
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
(defn to-int [x] (Integer/parseInt x) ) | |
(defn string-to-vector [x] (clojure.string/split x #" ")) | |
(def size (read-line)) | |
(def items (read-line)) | |
(println (reduce + (map to-int (string-to-vector items)))) | |
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 | |
//phpinfo(); | |
$multiple_upload = function (array $inputs){ | |
$result = array(); | |
if($inputs){ | |
foreach($inputs as $key => $index){ | |
if(is_array($index)){ | |
foreach($index as $i => $value){ | |
$result[$i][$key] = $value; |
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 | |
//file upload.php | |
$pic = $_FILES['pic']; | |
echo '<pre>'; | |
print_r($pic); | |
?> |
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
# How does it work? | |
# $ elixir -r chain.exs -e "Chain.run(1000)" to have one thousand processes. | |
defmodule Chain do | |
def counter(next_pid) do | |
receive do | |
n -> send next_pid, n + 1 | |
end | |
end |
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
describe HappyNumber do | |
it "Is possible to chek if a number is happy?" do | |
happy_number = HappyNumber.new | |
expect(happy_number.happy?(7)).to be true | |
end | |
end | |
#happy_number.rb | |
class HappyNumber | |
def happy?(number) |
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
npm config set registry https://registry.npmjs.org/ |
NewerOlder