aw
– a word (includes surrounding white space)iw
– inner word (does not include surrounding white space)
as
- a sentence
class FlashMessages extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { messages: props.messages }; | |
} | |
render () { | |
return( | |
<div> |
# equal jsons | |
json1 = '{"polygons":[{"type":"rectangle","vertices":[{"x":1621.5,"y":1079.5},{"x":2674,"y":1079.5},{"x":2674,"y":2528},{"x":1621.5,"y":2528}],"category":"name"}]}' | |
json2 = '{"polygons":[{"type":"rectangle","category":"name","vertices":[{"x":1621.5,"y":1079.5},{"x":2674,"y":1079.5},{"x":2674,"y":2528},{"x":1621.5,"y":2528}]}]}' | |
rez1 = JSON.parse(json1) | |
rez2 = JSON.parse(json2) | |
rez1 == rez2 # true | |
def flatten(list), do: flatten(list, []) |> Enum.reverse | |
def flatten([h | t], acc) when h == [], do: flatten(t, acc) | |
def flatten([h | t], acc) when is_list(h), do: flatten(t, flatten(h, acc)) | |
def flatten([h | t], acc), do: flatten(t, [h | acc]) | |
def flatten([], acc), do: acc |
sudo killall -HUP mDNSResponder |
############################## | |
##Exercise: ModulesAndFunctions-6 | |
defmodule Chop do | |
def guess(actual, lo..hi) when (lo <= hi) and (actual in lo..hi) do | |
current = guessing(lo, hi) | |
IO.puts "Is it #{current}" | |
guess(current, actual, lo..hi) | |
end | |
defp guess(value, actual, _) when value == actual, do: IO.puts value |
class String | |
def leftpad(len : Int, char = ' ') | |
char, len = char.to_s, len - self.size | |
raise ArgumentError.new if char.size != 1 | |
len > 0 ? (char * len + self) : self | |
end | |
end |
# create dump of the database on remote server | |
$ mongodump --host remote_host --db database_name | |
# import into database on localhost | |
$ mongorestore --host localhost --dir dump/database_name/ --db database_name --drop |
$$$ | |
crystal | |
crystal run | |
crystal build | |
crystal version |
Create db dump:
mysqldump -u user -p db_name > db_name.sql
Restore db dump:
mysql -u user -p db_name < db_name.sql