Skip to content

Instantly share code, notes, and snippets.

@it-one-mm
it-one-mm / list.dart
Last active September 5, 2020 11:31
void main() {
List<String> myList = [
'Angela',
'James',
'Katie',
'Jack',
];
}
// Relational Operators
// == equal
// != not equal
// > greater than
// >= greater than or equal to
// < less than
// <= less than or equal to
// Logical Operators
// && AND
@it-one-mm
it-one-mm / settings.json
Created May 1, 2020 12:46
VSCode Settings
{
"workbench.colorTheme": "Ayu Mirage",
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 19,
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"debug.console.fontSize": 18,
"markdown.preview.fontSize": 18,
"terminal.integrated.fontSize": 18,
@it-one-mm
it-one-mm / _mockLocation.js
Last active May 21, 2020 16:03
Fake Locations To Test for Expo Client App
import * as Location from 'expo-location';
const tenMetersWithDegrees = 0.0001;
const getLocation = (increment) => {
return {
timestamp: 1000000,
coords: {
speed: 0,
heading: 0,
@it-one-mm
it-one-mm / scratch.dart
Created May 30, 2020 06:53
Starting Code for Futures/Async/Await Demo
import 'dart:io';
void main() {
performTasks();
}
void performTasks() {
task1();
task2();
task3();
@it-one-mm
it-one-mm / loop.dart
Last active January 13, 2021 09:12
Dart Sample
void main() {
for(int i = 1; i <= 5; i++) {
print('hello $i');
}
print('finish loop');
// i i < 5 i++
// 0 0 < 5 Hello 0
@it-one-mm
it-one-mm / createDataContext.tsx
Created June 23, 2020 17:06
Create Global Context
import React, { Dispatch, useReducer, createContext, ReactNode } from 'react';
type Props = {
children: ReactNode;
};
function createDataContext<S, A>(
reducer: (state: S, action: A) => S,
initialState: S
) {
@it-one-mm
it-one-mm / async-await-exercise.js
Created July 7, 2020 10:03
Async Await Course in React Native from IT ONE MM
getCustomer(1, (customer) => {
console.log('Customer: ', customer);
if (customer.isGold) {
getTopMovies((movies) => {
console.log('Top movies: ', movies);
sendEmail(customer.email, movies, () => {
console.log('Email sent...')
});
});
@it-one-mm
it-one-mm / change_route.dart
Last active September 23, 2020 09:12
Change Route like Viu using Drawer
void _changeRoute(BuildContext context, String newRouteName) {
print('newRouteName: $newRouteName');
// Close drawer
Navigator.pop(context);
// Check current screen status
bool currentRouteIsHome = false;
bool currentRouteIsNewRoute = false;
Navigator.popUntil(context, (currentRoute) {
@it-one-mm
it-one-mm / UploadAnt.tsx
Created August 21, 2020 06:07
File Upload using Ant with s3
import React, { useState } from 'react';
import { Upload, Button, message } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
import axios from 'axios';
import { generateDateForFileName } from '../utils/helpers';
const nodeServerEndpoint = 'http://localhost:4000/api/v1/aws/sign-s3';
const phpServerEndpoint = 'http://localhost:9000/api/v1/signed-url-put-object';
const UploadAnt = () => {