Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
)
type Int int
func (n Int) Equal(m Int) bool { return n == m }
package main
import (
"fmt"
)
func Map[T, U any](values []T, mapper func(T) U) []U {
var result []U
for _, v := range values {
result = append(result, mapper(v))
package main
import "fmt"
func main() {
ptr := Ptr[bool](false)
fmt.Println(ptr)
var sum int
Apply[int]([]int{10, 20}, func(i, v int) {
package main
import (
"errors"
"fmt"
"reflect"
)
var ErrNotPointerToString = errors.New("Not a pointer to a string")
@jqjk
jqjk / WebsiteAndStoreCreator.php
Last active September 9, 2021 20:12 — forked from 0-Sony/WebsiteAndStoreCreator.php
Magento 2 : Create Programmatically Website/Store/StoreGroup
<?php
namespace Example\Store\Setup;
use Magento\Framework\App\Area;
use Magento\Framework\App\State;
use Magento\Framework\Config\ScopeInterface;
use Magento\Framework\Event\ManagerInterface;
use Magento\Store\Model\Group;
use Magento\Store\Model\GroupFactory;