Skip to content

Commit b732866

Browse files
committed
add temperature and string manip
1 parent 070e0b3 commit b732866

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

blog/gists/math.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ const formatPhone = digts => `(${digts.slice(0,3)}) ${digts.slice(3,6)}-${digts.
119119
const phoneToNumString = phone => phone.match(/\d/g).join("");
120120
```
121121

122+
## Science
123+
124+
### Temperature conversion
125+
126+
chemistry calculations
127+
128+
```js
129+
const c2f = c => ( c * 9/5 ) + 32;
130+
const f2c = f => ( f - 32 ) * 5/9;
131+
132+
const c2k = c => c + 273.15;
133+
const k2c = k => k - 273.15;
134+
135+
const f2k = f => f2c(f) + 273.15;
136+
const k2f = k => c2f(k - 273.15);
137+
```
122138

123139
## Currency conversions
124140

blog/gists/object copy.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: String
3+
permalink: blog/gists/javascript/string
4+
parent: JavaScript
5+
nav_order: 9
6+
---
7+
8+
## String
9+
10+
### Count Occurrences of Chars or Substring Occurances in a String
11+
12+
String manipulation, counting and accounting
13+
14+
```js
15+
const count = (str, subst) => str.match( new RegExp(subst, "g") )?.length || 0;
16+
```
17+

0 commit comments

Comments
 (0)