Some examples related to my tweet rant https://twitter.com/dsymetweets/status/1294276915260522496
In project programming this hit me this week with a bug:
Some examples related to my tweet rant https://twitter.com/dsymetweets/status/1294276915260522496
In project programming this hit me this week with a bug:
| { | |
| "name": "Build", | |
| "foreground": "#f1f1f1", | |
| "background": "#492D7C", | |
| "cursorColor": "#FFFFFF", | |
| "black": "#0C0C0C", | |
| "red": "#C50F1F", | |
| "green": "#13A10E", | |
| "yellow": "#C19C00", |
| .animated-placeholder { | |
| background: linear-gradient(-90deg, #eef2f6, #ffffff, #bcbfc3); | |
| background-size: 400% 400%; | |
| -webkit-animation: left-to-right 3s ease infinite; | |
| -moz-animation: left-to-right 3s ease infinite; | |
| animation: left-to-right 3s ease infinite; | |
| } | |
| @-webkit-keyframes left-to-right { |
| import React, { useEffect } from "react" | |
| import { META_DESCRIPTION } from "../../util" | |
| export const Page: React.FC<{ | |
| title?: string | |
| metaDescription?: string | |
| }> = props => { | |
| useEffect(() => { | |
| document.title = props.title ?? "Execute Program" |
| using System; | |
| using System.Threading; | |
| namespace PureDI | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| // Create the singletons once |
| // this is a big array of 76 items I need to split into groups of 10 | |
| const hugeArray = Array.from({ length: 76 }, (_, i) => i); | |
| function chunkify(array, chunkSize = 10) { | |
| // make a new array | |
| const chunks = Array.from( | |
| // give it however many slots are needed - in our case 8 | |
| // 1-7 with 10 items, and 8th slot will have 6 | |
| { length: Math.ceil(array.length / chunkSize) }, | |
| // this is a map function that will fill up our slots |
| <?php | |
| namespace App\Builders; | |
| use Illuminate\Database\Eloquent\Builder as BaseBuilder; | |
| class Builder extends BaseBuilder | |
| { | |
| public function search($term, $attributes) | |
| { |
| // Add this to the "boot()" method of your "AppServiceProvider" | |
| <?php | |
| \Illuminate\Database\Eloquent\Builder::macro('search', function ($name, $search) { | |
| return $this->where($name, 'LIKE', $search ? '%'.$search.'%' : ''); | |
| }); |
| <?php | |
| // Usage: | |
| // Before | |
| @if ($errors->has('email')) | |
| <span>{{ $errors->first('email') }}</span> | |
| @endif | |
| // After: |
| import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | |
| import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview'; | |
| import { | |
| createDropdown, | |
| addToolbarToDropdown | |
| } from '@ckeditor/ckeditor5-ui/src/dropdown/utils'; | |
| export default class MergeFields extends Plugin { | |
| static get pluginName() { | |
| return 'mergeFields'; | |
| } |