Skip to content

Instantly share code, notes, and snippets.

View mstaack's full-sized avatar
🎯
Focusing

Max mstaack

🎯
Focusing
View GitHub Profile
@schmunk42
schmunk42 / gist:4349624
Created December 20, 2012 23:44
Updated Yii Metadata component from http://www.yiiframework.com/extension/metadata/
<?
/**
* Metadata Helps to get metadata about models,controllers and actions in application*
*
* For using you need:
* 1. Place this file to directory with components of your application (your_app_dir/protected/components)
* 2. Add it to 'components' in your application config (your_app_dir/protected/config/main.php)
* 'components'=>array(
* 'metadata'=>array('class'=>'Metadata'),
* ...
@deividaspetraitis
deividaspetraitis / Application.php
Created October 5, 2017 06:03
Custom Request object is overridden by default Illuminate\Http\Request
<?php namespace App;
class Application extends \Laravel\Lumen\Application
{
use Concerns\RoutesRequests; // override with our new trait
}
@kimhogeling
kimhogeling / js_optional_chaining_operator.markdown
Last active February 26, 2018 22:31
Why the optional chaining operator might be pretty damn useful for readable code

Coming soon to JavaScript: Optional Chaining Operator

This example is inspired by mpjme's Fun Fun Function Video Watch that! It's short fun and explained really well!

This gist, is for me and my colleagues as a reference.

Given: Optional properties in an object

const hero1 = { name: 'Superman', address: { city: 'Metropolis', zip: 12345 } }
@Radostin
Radostin / twitter.html
Created November 6, 2017 20:25
Twitter Mockup with TailwindCSS
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Twitter</title>
<link rel="stylesheet" type="text/css" href="./css/tailwind.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
@Gummibeer
Gummibeer / TestCase.php
Last active March 21, 2020 14:37
phpunit testcase auto setup/teardown traits
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use JMac\Testing\Traits\HttpTestAssertions;
use Tests\Utils\CreateUploadedFileFromFilePath;
use Tests\Utils\IsRoutesAware;
use Tests\Utils\ResourceAsserts;
@xeoncross
xeoncross / ParensParser.php
Created February 4, 2013 22:28
PHP: Nested Parenthesis Parser
<?php
// @rodneyrehm
// http://stackoverflow.com/a/7917979/99923
class ParensParser
{
// something to keep track of parens nesting
protected $stack = null;
// current level
protected $current = null;
@itamarhaber
itamarhaber / scan_del.sh
Created April 20, 2014 22:27
A bash script that deletes Redis keys by pattern using SCAN
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Delete keys from Redis matching a pattern using SCAN & DEL"
echo "Usage: $0 <host> <port> <pattern>"
exit 1
fi
cursor=-1
@karanth
karanth / parse-imap.md
Last active August 7, 2022 06:27
Notes on parsing IMAP responses

The IMAP protocol workflow consists of the following steps,

  • A network connection established between the client and the server.
  • A greeting message sent by the server indicating that the client has successfully connected.
  • A series of interactions between the client and server.

The interactions consists of strings of lines, i.e. string terminated by a carriage return and a line feed (CRLF or \r\n). Interactions can be both commands (sent by clients) and data (sent by clients and servers). Both the client and the server strictly interact using lines or known length octet streams (8-bit characters) followed by a line.

####Client

An IMAP client issues commands to the server in a CRLF terminated string. The syntax of a command includes a tag, followed by the command and parameters. A tag is an alphanumeric identifier and each client command has a different tag for that session. A tag could be something like but not limited to A1, A2 etc.

@dasevilla
dasevilla / github-issue-to-phab-task.py
Created May 6, 2014 23:01
Copy GitHub issues to Phabricator
import json
import os
import requests
GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
if GITHUB_TOKEN is None:
raise Exception('Missing GITHUB_TOKEN from os.environ')
@blackfyre
blackfyre / GeneralModal.vue
Last active November 14, 2023 04:45
Modals in Laravel Nova Tools
<template>
<modal @modal-close="handleClose">
<form
@submit.prevent="handleConfirm"
slot-scope="props"
class="bg-white rounded-lg shadow-lg overflow-hidden"
style="width: 460px"
>
<slot :uppercaseMode="uppercaseMode" :mode="mode">
<div class="p-8">