Skip to content

Instantly share code, notes, and snippets.

View quanphm's full-sized avatar
🍵
I use Gitea btw

Quan Pham quanphm

🍵
I use Gitea btw
View GitHub Profile
@quanphm
quanphm / from_into.rs
Created November 27, 2023 03:52
rustling_94
#[derive(Debug)]
struct Person {
name: String,
age: usize,
}
// We implement the Default trait to use it as a fallback
// when the provided string is not convertible into a Person object
impl Default for Person {
fn default() -> Person {
@quanphm
quanphm / renderProp.js
Created March 10, 2018 18:22
Render prop
import React, { Fragment } from 'react'
import PropTypes from 'prop-types'
class FetchDataButton extends React.Component {
state = { data: null }
fetchData = () => (
fetch('https://swapi.co/api/people/1')
.then(rs => rs.json())
.then(rs => this.setState({ data: rs }))
@quanphm
quanphm / bulk_email.html
Last active August 29, 2015 14:02
Unschool Bulk Email Template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>{course_title}| Unschool.org</title><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/></head><body bgcolor="#bbddcc"><div style="position:relative;top:0;left:0;max-width:720px;margin:0 auto;font-size:.85em;background-color:#ecf0f1;"><div><img src="http://i335.photobucket.com/albums/m463/pmquan1993/uuu.png" alt="unschool logo" style="width:100%;height:auto;margin:0 auto;text-align:center;outline:0;border:none;display:block;"/></div><div style="font-size:1.5em;font-weight:700;margin:20px auto 10px;padding:10px;text-align:center;border-bottom:1px solid #2980b9;">{course_title}</div><div style="padding: 10px;">{{message_body}}</div><div style="background-color:#2c3e50;color:#fff;font-size:14px;padding:10px;margin:20px 0 0;"><p>&copy;2014 UnSchool.org</p