Skip to content

Instantly share code, notes, and snippets.

View bpesquet's full-sized avatar

Baptiste Pesquet bpesquet

View GitHub Profile
const rootEndpoint = "https://www.thecocktaildb.com/api/json/v1/1";
// Model class for a cocktail
export class Cocktail {
constructor(id, name, image, instructions) {
this.id = id;
this.name = name;
this.image = image;
this.thumbnail = image + "/preview";
this.instructions = instructions;
@bpesquet
bpesquet / .gitattributes-lfs-unity
Last active December 7, 2022 22:37
.gitattributes file for LFS with Unity
* text=auto
# Unity files
*.meta -text -merge=unityamlmerge
*.unity -text -merge=unityamlmerge
*.asset -text -merge=unityamlmerge
*.prefab -text -merge=unityamlmerge
# Image formats
*.psd filter=lfs diff=lfs merge=lfs -text
using MvcUniversity.Data;
namespace MvcUniversity.Models;
public class SeedData
{
public static void Init()
{
using (var context = new UniversityContext())
{
// Add students
Student carson = new Student
{
FirstName = "Alexander",
LastName = "Carson",
EnrollmentDate = DateTime.Parse("2016-09-01"),
};
Student alonso = new Student
{
FirstName = "Meredith",
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MvcUniversity.Models;
namespace MvcUniversity.Data
{
public static class SeedData
{
@model MvcUniversity.Models.Instructor
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Instructor</h4>
<hr />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using MvcUniversity.Data;
using MvcUniversity.Models;
namespace MvcUniversity.Controllers
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using MvcUniversity.Models;
namespace MvcUniversity.Data
{
public static class SeedData
@bpesquet
bpesquet / todo.service.ts
Created March 1, 2021 17:41
Async storage of todos
import AsyncStorage from "@react-native-async-storage/async-storage";
export interface Todo {
task: string;
completed: boolean;
}
class TodoService {
// Return all todos asynchronously. Returns a Promise
async getAll(): Promise<Array<Todo>> {
export interface Todo {
task: string;
completed: boolean;
}
class TodoService {
private todos: Array<Todo> = [];
// Return all todos asynchronously. Returns a Promise
getAll(): Promise<Array<Todo>> {