My page about me. Free Code Camp's portfolio project.
This file contains 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
void main() { | |
Map<String, dynamic> json = {'type': null}; | |
try { | |
ElementType too = ElementType.fromString(null); // passes null through (explicitly) | |
ElementType foo = ElementType.fromString(json['type']); // passes null through (explicitly via map) | |
ElementType bar = ElementType.fromString(json['key_missing']); // passes null through (implicitly via map) | |
ElementType baz = ElementType.fromString(); // does NOT pass null; factory uses 'default string' | |
HashyType bro = HashyType.fromString(stringValue: null); // passes null through (explicitly) |
This file contains 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 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains 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 'package:flutter/material.dart'; | |
import 'dart:math' as math; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { |
This file contains 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
void main() { | |
void functionDeclaration() => print("I'm definitely declared!"); | |
var functionAssignment = () => print("I'm ostensibly anonymous."); | |
functionDeclaration(); | |
functionAssignment(); | |
print(functionDeclaration); | |
print(functionAssignment); | |
} |
This file contains 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 React from 'react' | |
import { shallow } from 'enzyme' | |
import HelloReact from 'packs/hello_react' | |
describe('HelloReact component', () => { | |
describe('when a name is given as a prop', () => { | |
it('renders Hello Aaron!', () => { | |
expect(shallow(<HelloReact name="Aaron" />).text()).toBe('Hello Aaron!') | |
}) | |
}) |
This file contains 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
class DiceSet | |
attr_reader :values | |
def initialize; end | |
def roll(i) | |
@values = [] | |
i.times do | |
@values << rand(5)+1 | |
end | |
end | |
end |
This file contains 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
def score(dice) | |
# You need to write this method | |
case dice | |
when [], [2,3,4,6] then 0 | |
when [5] then 50 | |
when [1] then 100 | |
when [1,1,1] then 1000 | |
when [2,2,2] then 200 | |
when [3,3,3], [1,5,5,1] then 300 | |
when [4,4,4] then 400 |
This file contains 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
# Triangle Project Code. | |
# Triangle analyzes the lengths of the sides of a triangle | |
# (represented by a, b and c) and returns the type of triangle. | |
# | |
# It returns: | |
# :equilateral if all sides are equal | |
# :isosceles if exactly 2 sides are equal | |
# :scalene if no sides are equal | |
# |