Skip to content

Instantly share code, notes, and snippets.

View amitmerchant1990's full-sized avatar

Amit Merchant amitmerchant1990

View GitHub Profile
<?php
function memoize($target) {
static $memo = new WeakMap;
return new class ($target, $memo) {
function __construct(
protected $target,
protected &$memo,
) {}
@antfu
antfu / doc-table.md
Last active October 14, 2023 20:09
Doc Table in Markdown

Example

Name

Description


@mpociot
mpociot / CanBeReplicated.php
Created June 12, 2019 12:32
Add the ability to replicate Laravel models to other models.
<?php
use Illuminate\Support\Arr;
trait CanBeReplicated
{
public function replicateTo(string $model, array $with = null, array $except = null)
{
$defaults = [
$this->getKeyName(),
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active March 28, 2024 01:45
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@amitmerchant1990
amitmerchant1990 / stylish.css
Last active March 26, 2021 02:21
Revert back to good old GitHub Homepage
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the CSS mentioned below.
3. Specify the "URLs on the domain" to be `github.com`.
4. Add a title and save.
*/
.dashboard-sidebar {
float: right;
padding-right: 10px;
@gornostal
gornostal / README.md
Last active April 26, 2024 15:26
Ulauncher Color Themes

This will be a temporary site for sharing Ulauncher color themes

When posting a theme make sure it has

  • title (theme name or whatever)
  • link to a gist or github repo with theme files
  • screenshot attached (just drag an image onto a comment area)

@notwaldorf
notwaldorf / 👀.md
Last active February 18, 2024 21:13
Advice for new developers

Someone sent me an email asking me what advice I had for new developers. I get this question a bunch, so I wanted to put all my thoughts in one place, that I can update as I get more ideas!

I answered this a bunch on my AMA repo, so here's some initial general answers, before I get to some of the specific questions:

@odan
odan / rest_quick_reference.md
Last active September 1, 2021 20:06
REST, RESTful API Quick Reference
@amitmerchant1990
amitmerchant1990 / github_code_previewer_dark_skin.css
Created November 9, 2016 12:29
GitHub Code Previewer Dark Skin
/**
A nifty little CSS to experience GitHub code previewer in Dark Skin using Stylish.
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the whole CSS mentioned below.
3. Add "URLs on the domian to" to be `render.githubusercontent.com`.
4 Add "URLs on the domian to" to be `raw.githubusercontent.com`.
4 Add "URLs matching the regexp" to be `^https?://((gist|guides|help|raw|status|developer).)?github.com((?!generated_pages/preview).)*$`.
4. Add a title and save.
*/