Skip to content

Instantly share code, notes, and snippets.

@0xMatt
0xMatt / Contact.tsx
Created July 1, 2025 16:50
Component rendering twice
'use client';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Send } from 'lucide-react';
import { useActionState } from 'react';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import Form from 'next/form';
import { contact } from '@/app/contact/actions';
@0xMatt
0xMatt / sed-collation-issue-fixes
Created March 30, 2022 20:57 — forked from amurrell/sed-collation-issue-fixes
Fix collation and character set error from old mysql
# Unknown collation: 'utf8mb4_unicode_520_ci'
sed -i'.bak' "s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g;" file.sql
# COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'
sed -i'.bak' "s/utf8_general_ci/utf8mb4_unicode_ci/g;" file.sql
@0xMatt
0xMatt / .compton.conf
Last active October 11, 2018 05:41
Dots
# Basic compton config with fade transition and shadows
# Full list of options at: https://github.com/chjj/compton/blob/master/man/compton.1.asciidoc
# Performance tweak options, more info at https://github.com/chjj/compton/wiki
paint-on-overlay = true; # Paint on X Composite overlay window instead of on root window
glx-no-stencil = true;
glx-no-rebind-pixmap = true;
# Drop shadows
@0xMatt
0xMatt / my.initializer.ts
Last active March 26, 2017 19:15
OBJECTS is empty when compiled but when via ng serve
import {OBJECTS} from './my.token.ts';
@Injectable()
export class MyInitializer {
constructor(private injector: Injector) {
}
appInitializer(): Promise<any> {
const p: Promise<any> = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
return p.then(() => {
@0xMatt
0xMatt / Drisate.php
Created October 27, 2016 14:34
crappily filter by timestamp in last hour
<?php
foreach (new DirectoryIterator('./') as $fileInfo) {
if($fileInfo->isDot()) continue;
$file = $fileInfo->getBasename();
//var_dump($file);
<?php
$json = <<<JSON
{
"kind": "youtube#searchListResponse",
"etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/hys1HflQr8XiiYpydVnkJA-oudA\"",
"regionCode": "DE",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
import {Component} from '@angular/core';
import {ROUTER_DIRECTIVES} from '@angular/router';
import '../style/app.scss';
import {ToasterContainerComponent, ToasterService} from 'angular2-toaster/angular2-toaster';
import {MenuComponent} from './layout/menu/menu.component';
import {ContentComponent} from './layout/content/content.component';
import {AuthService} from "./modules/auth/auth.service";
/*
* App Component
@0xMatt
0xMatt / mortgageJavascript.html
Created January 31, 2016 23:24 — forked from anonymous/mortgageJavascript.html
theomega76PHP-HELL
<!DOCTYPE html>
<html>
<head>
<title>Theomega76| Mortgage Table with Inputs</title>
<meta charset="utf-8" />
<!-- Move to bottom later on for better performance -->
<script src="js/jquery-1.11.2.js"></script>
</head>
<?php
class ImplementationTest extends TestCase
{
public function setUp()
{
parent::setUp();
$this->setUpDb();
}
@0xMatt
0xMatt / cache.conf
Created June 28, 2015 22:59
nginx setup
# Expire rules for static content
# No default expire rule. This config mirrors that of apache as outlined in the
# html5-boilerplate .htaccess file. However, nginx applies rules by location,
# the apache rules are defined by type. A consequence of this difference is that
# if you use no file extension in the url and serve html, with apache you get an
# expire time of 0s, with nginx you'd get an expire header of one month in the
# future (if the default expire rule is 1 month). Therefore, do not use a
# default expire rule with nginx unless your site is completely static