Skip to content

Instantly share code, notes, and snippets.

View jaspalt's full-sized avatar
👨‍🚀
Prepping for take off.

Jas jaspalt

👨‍🚀
Prepping for take off.
View GitHub Profile
@JeffreyWay
JeffreyWay / recaptcha.blade.php
Last active June 28, 2024 11:00
Recaptcha Example using Laravel, Blade Components, and Alpine
<div
x-data="recaptcha()"
x-init="init"
@recaptcha.window="execute"
></div>
@push('scripts')
<script src="https://www.google.com/recaptcha/api.js?render=explicit"></script>
<script>
@julienbourdeau
julienbourdeau / webpack.mix.js
Created April 20, 2020 06:43
Laravel Mix with multiple Tailwind config and PurgeCSS (separate Admin dashboard and Front app)
const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
const rootPath = Mix.paths.root.bind(Mix.paths);
const tailwindPlugins = function(configFile, paths) {
const pluginList = [tailwindcss(configFile)];
if (mix.inProduction()) {
pluginList.push(require('@fullhuman/postcss-purgecss')({
#!/bin/bash
PLATFORM=iPhoneOS # iPhoneSimulator # iPhoneOS
HOST=arm-apple-darwin # i386-apple-darwin10 # arm-apple-darwin10
ARCH=arm64 # i386 # armv7s #armv7
SDK_VERSION=13.0
XCODE_ROOT=`xcode-select -print-path`
PLATFORM_PATH=$XCODE_ROOT/Platforms/$PLATFORM.platform/Developer
SDK_PATH=$PLATFORM_PATH/SDKs/$PLATFORM$SDK_VERSION.sdk
@didicodethat
didicodethat / YoutubeUrlParser.php
Last active September 15, 2017 17:49
A simple multipurpose php youtube url parser, this was used for specific needs so it is not really generic.
<?php
class YoutubeUrlParser
{
const REGULAR_URL_FORMAT = '/^https?:\/\/(www\.)?youtube\.com\/watch/';
const EMBEDDED_URL_FORMAT = '/^https?:\/\/(www\.)?youtube\.com\/embed/';
const SHARE_URL_FORMAT = '/^https?:\/\/(www\.)?youtu\.be\//';
private $originalUrl;
private $videoId;
@benluxford
benluxford / WebhooksController.php
Last active June 10, 2017 16:52
Stripe Webhook Controller with Event Checking for Laravel 5
<?php
namespace App\Http\Controllers;
use Stripe\Stripe;
use Stripe\Event;
use Illuminate\Http\Request;
class WebhooksController extends Controller
{
@rizkysyazuli
rizkysyazuli / tail-slack.sh
Last active June 21, 2021 07:56
[Shell - Server Log to Slack] Sends server log entries to Slack via webhook #webhook #slack #apache #nginx #shell
#!/bin/bash
tail -n0 -F "$1" | while read LINE; do
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2";
done
# to monitor a single session
# ./tail-slack.sh "/var/log/nginx/access-web.log" "https://hooks.slack.com/services/..." " 500 "
@Yimiprod
Yimiprod / difference.js
Last active August 6, 2024 06:25
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
@Iman
Iman / clean.sh
Last active September 11, 2024 11:12
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@bjcull
bjcull / bootstrapSwitch.js
Created July 24, 2014 06:04
Angular directive for bootstrap-switch | http://www.bootstrap-switch.org/
.directive('bootstrapSwitch', [
function() {
return {
restrict: 'A',
require: '?ngModel',
link: function(scope, element, attrs, ngModel) {
element.bootstrapSwitch();
element.on('switchChange.bootstrapSwitch', function(event, state) {
if (ngModel) {