Skip to content

Instantly share code, notes, and snippets.

View avrahamappel's full-sized avatar

Avraham Appel avrahamappel

View GitHub Profile
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 20, 2024 21:24
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@glandaverde
glandaverde / fileextension.rs
Created November 14, 2017 20:55
Get file extension Rust
use std::path::Path;
use std::ffi::OsStr;
fn main() {
fn get_extension_from_filename(filename: &str) -> Option<&str> {   
Path::new(filename)       
.extension()       
.and_then(OsStr::to_str)}
assert_eq!(get_extension_from_filename("abc.gz"), Some("gz"));
@rambabusaravanan
rambabusaravanan / detect-js-framework.js
Last active March 29, 2024 11:39
Detect JS Framework used in a Website
// Paste these lines into website's console (Win/Linux: Ctrl + Shift + I / Mac: Cmd + Alt + I)
if(!!window.React ||
!!document.querySelector('[data-reactroot], [data-reactid]') ||
Array.from(document.querySelectorAll('*')).some(e => e._reactRootContainer !== undefined || Object.keys(e).some(k => k.startsWith('__reactContainer')))
)
console.log('React.js');
if(!!document.querySelector('script[id=__NEXT_DATA__]'))
console.log('Next.js');
@barryvdh
barryvdh / pre-commit
Last active May 16, 2023 12:37
phpunit pre-commit git hook
#!/usr/bin/env php
<?php
echo "Running tests.. ";
exec('vendor/bin/phpunit', $output, $returnCode);
if ($returnCode !== 0) {
// Show full output
echo PHP_EOL . implode($output, PHP_EOL) . PHP_EOL;
echo "Aborting commit.." . PHP_EOL;