Skip to content

Instantly share code, notes, and snippets.

View cbrevik's full-sized avatar
🙈

Christian Brevik cbrevik

🙈
View GitHub Profile
@cbrevik
cbrevik / ios_bundle.sh
Last active October 17, 2020 21:26
RN iOS bundle command
npx react-native bundle
--platform ios
--dev false
--reset-cache
--entry-file index.js
--bundle-output main.jsbundle
int firstDigit = int.Parse(ssn.Substring(0, 1));
int thirdDigit = int.Parse(ssn.Substring(2, 1));
string type = (firstDigit, thirdDigit) switch
{
(8 or 9, _) => "FH",
( >= 4 and <= 7, _) => "D",
  (_, 4 or 5) => "H",
_ => null
};
int birthYear = (ruleNumber, year) switch
{
// Rule 1. 500–749: 1854–1899
(>= 500 and <= 749, >= 54) => 1800 + year,
// Rule 2. 000–499: 1900–1999
(< 500, _) => 1900 + year,
// Rule 3. 900–999: 1940–1999
(>= 900, >= 40) => 1900 + year,
// Rule 4. 500–999: 2000–2039
(>= 500, <= 39) => 2000 + year,
int day = int.Parse(ssn.Substring(0, 2));
int month = int.Parse(ssn.Substring(2, 2));
int year = int.Parse(ssn.Substring(4, 2));
int ruleNumber = int.Parse(ssn.Substring(6, 3));
int birthYear = 0;
// Rule 1. 500–749: 1854–1899
if (year >= 54 && ruleNumber >= 500 && ruleNumber <= 749)
{
birthYear = 1800 + year;
@cbrevik
cbrevik / config.fish
Created April 8, 2019 12:37
Fishshell config
# just the most essential stuff
abbr ga 'git add'
abbr gs 'git status'
abbr gb 'git branch'
abbr gcom 'git commit'
abbr gd 'git difftool --no-prompt'
abbr gdd 'git difftool --dir-dif'
abbr gco 'git checkout'
abbr gpr 'git pull --rebase'
@cbrevik
cbrevik / react-native-sketch-canvas+0.3.1.patch
Created May 19, 2018 20:55
Basic addImage behind drawing canvas for react-native-sketch-canvas
patch-package
--- a/node_modules/@terrylinla/react-native-sketch-canvas/index.js
+++ b/node_modules/@terrylinla/react-native-sketch-canvas/index.js
@@ -8,6 +8,7 @@ import ReactNative, {
ViewPropTypes,
} from 'react-native'
import SketchCanvas from './src/SketchCanvas'
+import resolveAssetSource from "react-native/Libraries/Image/resolveAssetSource"
export default class extends React.Component {
{
"accessibilityLabel": "NSString",
"accessibilityTraits": "UIAccessibilityTraits",
"accessibilityViewIsModal": "BOOL",
"accessible": "BOOL",
"alignContent": "YGAlign",
"alignItems": "YGAlign",
"alignSelf": "YGAlign",
"aspectRatio": "float",
"backfaceVisibility": "css_backface_visibility_t",
{
"autoCapitalize": "UITextAutocapitalizationType",
"autoCorrect": "UITextAutocorrectionType",
"blurOnSubmit": "BOOL",
"clearTextOnFocus": "BOOL",
"color": "UIColor",
"dataDetectorTypes": "UIDataDetectorTypes",
"editable": "BOOL",
"enablesReturnKeyAutomatically": "BOOL",
"fontFamily": "NSString",
{
"accessibilityComponentType": "String",
"accessibilityLabel": "String",
"accessibilityLiveRegion": "String",
"accessible": "boolean",
"alignContent": "String",
"alignItems": "String",
"alignSelf": "String",
"aspectRatio": "number",
"backgroundColor": "Color",