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
Prompt: Can you write a python function that finds all O or o letters in a sentence and converts them to a 0? | |
Okay, the user wants a Python function that changes all 'O's and 'o's in a sentence to '0'. Let me think about how to approach this. | |
First, I need to create a function. Maybe call it convert_os_to_zeros. It should take a string as input. | |
The goal is to replace every occurrence of 'O' or 'o' with '0'. So I can use the string's replace method. But wait, replace only replaces exact matches and does it sequentially. Since both uppercase and lowercase are targets, perhaps using a translation table would be more efficient, especially for multiple replacements. | |
Alternatively, using the translate() method with a translation table that maps 'O' and 'o' to '0'. That might be a good approach. So I'll create a translation table where ord('O') maps to ord('0'), same for 'o'. | |
Wait, but in Python, the str.translate() method expects a dictionary where keys are Unicode ordinals, and values are the replacements. So I |
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 { Injectable } from "@angular/core"; | |
import { createRxDatabase, addRxPlugin, RxCollection, RxDatabase, RxJsonSchema } from "rxdb"; | |
import * as pouchdbaAdapter from "pouchdb-adapter-idb"; | |
import { BehaviorSubject } from "rxjs"; | |
import { RxCollectionCreatorBase } from "rxdb/dist/types/types"; | |
interface Collection { | |
name: string; | |
schema: RxJsonSchema; | |
} |
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
#cloud-config | |
ssh_authorized_keys: | |
- ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAyMD8pv7LRGdYrXJ5cF18LYRAcUzviJonnVkv | |
oH20jxHqZFNowCPz9J6dAxpCMzlBV+Bmae1FX2Sj5zmpR4Tg2WF1vpo7gkNrbOp1 | |
zQ6fIP9v18YfN8XBac5BtTUwMaYaWv8J0eTAvnXF+qXRglpLT6tQz/6e279RxiEi | |
vEnzw6wyc+uPJ0YWZ32CbAGm5rSLduqJ06iDgQQluzPDXhl2SEa4ZOI2tPE/BPEH | |
+1Lz2YigCjCsG1MUsrtaAMwlW8T2T6DBcy0TLF0iD7oTdzNP4We1+o7AxCsTk4Cl | |
ZQIATY3NscXxJvsb8tF+1p7xkwcxUQ4mCchL5kVA+N46D0Tmnw== |
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
const VO = require('value-object-js'); | |
abstract class ValueObject { | |
constructor(private name: string, private value: any) { | |
const ValueObj = VO.define(name ,{ | |
validate: (value) => { return value } | |
}); | |
return new ValueObj(value); | |
} | |
} |
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
$computers = (gc C:\Users\winuser\scripts\computers.txt).split(",") | |
foreach ($computer in $computers) { | |
if (Test-Connection -ComputerName $computer) { | |
$session = New-PSSession -ComputerName $computer | |
Invoke-Command -Session $session -ScriptBlock { | |
Start-ScheduledTask "StartKiosk" | |
} -AsJob | |
} |
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
#-------------------------------------------------------------------------------------------------- | |
# | |
# File: app_endco_dental.pl | |
# Version: 1.00 | |
# Date: 20120721 | |
# | |
# COPYRIGHT 2012 e-Tech Solutions, Inc. | |
# | |
# Any unauthorized reproduction or use of this script in part or whole is a violation of copyright | |
# laws and is strictly prohibited. |
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
Hi Derek! I'm sorry I didn't see your first email -- it ended up in my spam folder! >_< | |
I really appreciate your reaching out, and I'm afraid this is a trademark concern, particularly because it involves selling products with the Rust logo. :( Even though it affects good faith work like yours, protecting the trademark is something we have to do across the board. | |
I'm sorry to be the bearer of bad news, and I totally appreciate your intentions and efforts. You might be interested in some discussions around community design, which were kicked off here: | |
https://internals.rust-lang.org/t/should-rust-have-an-art-design-team/2075/19 | |
There's a new #rust-design channel on irc.mozilla.org where people interested in community design are meeting. In general, the Rust team absolutely wants to encourage community design. But at the same time we have some constraints when it comes to trademark, particularly around the logo and certain uses of the "Rust" name. I'm hoping to help the team provide some guidance about these |
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
iex(1)> event = [%{"eventId" => "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4", "eventType" => "event-type", "data" => %{"a" => "1"}}] | |
[%{"data" => %{"a" => "1"}, "eventId" => "fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4", | |
"eventType" => "event-type"}] | |
iex(2)> {:ok, json_event} = JSX.encode event | |
{:ok, | |
"[{\"data\":{\"a\":\"1\"},\"eventId\":\"fbf4a1a1-b4a3-4dfe-a01f-ec52c34e16e4\",\"eventType\":\"event-type\"}]"} | |
iex(3)> {:ok, post} = HTTPoison.request(:post, "http://127.0.0.1:2113/streams/newstream", json_event, [{"Content-Type", "vnd.eventstore.events+json"}]) | |
{:ok, |
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
** (exit) no process | |
(stdlib) gen.erl:161: :gen.call/4 | |
(elixir) lib/gen_event.ex:519: GenEvent.rpc/2 | |
(elixir_cqrs_es) lib/bank/bank_app.ex:11: BankApp.start/2 |
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
defmodule BankPlayground do | |
defmodule State do | |
defstruct [:id, :date_created, :balance, :changes] | |
@type t :: %State{} | |
end | |
defmodule AccountCreated do | |
defstruct [:id, :date_created] | |
@type t :: %AccountCreated{} |