Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
import React, { Component } from 'react'; | |
import findByType from './findByType'; | |
import css from './somestyle.css'; | |
// We instantiate the Title sub-component | |
const Title = () => null; | |
class Article extends Component { | |
// This is the function that will take care of rendering our Title sub-component | |
renderTitle() { | |
const { children } = this.props; | |
// First we try to find the Title sub-component among the children of Article |
import React from 'react'; | |
const findByType = (children, component) => { | |
const result = []; | |
/* This is the array of result since Article can have multiple times the same sub-component */ | |
const type = [component.displayName] || [component.name]; | |
/* We can store the actual name of the component through the displayName or name property of our sub-component */ | |
React.Children.forEach(children, child => { | |
const childType = | |
child && child.type && (child.type.displayName || child.type.name); | |
if (type.includes(childType)) { |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
Commit type | Emoji |
---|---|
Initial commit | 🎉 :tada: |
Version tag | 🔖 :bookmark: |
New feature | ✨ :sparkles: |
Bugfix | 🐛 :bug: |
<?php | |
namespace App\Http\Requests; | |
use Illuminate\Http\JsonResponse; | |
use Illuminate\Validation\ValidationException; | |
use Illuminate\Contracts\Validation\Validator; | |
use Illuminate\Http\Exceptions\HttpResponseException; | |
use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest; |
<?php | |
namespace Tests\Traits; | |
use App\User; | |
trait AttachJwtToken | |
{ | |
/** | |
* @var User |
Vanilla Debounce esnextbin
const getInfo = async () => { | |
console.log(await axios.get('/users')) | |
console.log(await getGroups()) | |
console.log(await getFavorites()) | |
return 'all done'; | |
} | |
getInfo(); |
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
<?php | |
namespace App\Http\Controllers; | |
use App\Models\Project; | |
use Illuminate\Http\Request; | |
class ProjectController extends Controller | |
{ | |
public function update(Request $request, Project $project) |