Skip to content

Instantly share code, notes, and snippets.

View ValeriiVasin's full-sized avatar
🇺🇦

Valerii Vasin ValeriiVasin

🇺🇦
View GitHub Profile
import React, { Suspense, useState } from "react";
import { unstable_createResource as createResource } from "react-cache";
import {
Combobox,
ComboboxInput,
ComboboxList,
ComboboxOption
} from "./Combobox2.js";
function App({ tabIndex, navigate }) {
@agentcooper
agentcooper / 0.README.md
Last active March 10, 2018 13:49
Sort YouTube playlist/channel by view count or average rating
@navix
navix / readme.md
Last active August 4, 2023 09:02
TypeScript Deep Partial Interface

TypeScript Deep Partial Interface

export type DeepPartial<T> = T extends Function ? T : (T extends object ? { [P in keyof T]?: DeepPartial<T[P]>; } : T);

Before typescript@3.1

type DeepPartial = {
@erikringsmuth
erikringsmuth / JavaScript DI and Modules.md
Last active March 24, 2017 10:15
JavaScript DI and Modules

Here's a more in depth explanation of Angular's DI, RequireJS, and what's coming up in Angular 2.0 and ES6 modules.

Angular DI is not a module loader! It injects objects that have already been loaded using script tags. It does not do lazy-loading. Angular 2.0 will use ES6 import for module loading. Angular 2.0 will also add a DI layer that runs after the modules load.

I need to go over Java's import vs. JavaScript's require/import and Java singletons to further explain what Angular's DI is doing.

Java's import allows you to access another package's types without fully qualifying the package name. JavaScript's import loads a module and creates references to the module's exported objects. These are very different operations. JavaScript's import is powerful stuff! You have the objects, not just aliases to a package's types.

Singleton is a pattern, not the object itself. In Java you start with a type and have to create an instance. The singleton pattern ensures you have only 1 instance of that t

@igrigorik
igrigorik / github.bash
Last active December 22, 2023 23:55
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@domenic
domenic / 1-Domenic.js
Last active September 30, 2021 15:43
How DI container config should work (in JS)
"use strict";
// Domenic needs a Tweeter
function Domenic(tweeter) {
this.tweeter = tweeter;
}
Domenic.inject = ["tweeter"];
Domenic.prototype.doSomethingCool = function () {
return this.tweeter.tweet("Did something cool!");
@tj
tj / wtf.js
Created November 6, 2012 06:33
(function( app ) {
'use strict';
var ApplicationView = Ember.ContainerView.extend({
childViews: [ 'headerView', 'mainView', 'footerView' ],
headerView: Ember.ContainerView.create({
childViews: [ 'titleView', 'createTodoView' ],
elementId: 'header',
tagName: 'header',
titleView: Ember.View.create({
@dmitriy-kiriyenko
dmitriy-kiriyenko / gist:3904260
Created October 17, 2012 07:45
How to remove mysql on OS X
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
sudo rm /etc/my.cnf
sudo sed '/MYSQLCOM=-YES-/d' /etc/hostconfig # remove line MYSQLCOM=-YES- from /etc/hostconfig
@domenic
domenic / promises.md
Last active June 24, 2024 03:11
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.