Skip to content

Instantly share code, notes, and snippets.

View xhezairbey's full-sized avatar

Arian Xhezairi xhezairbey

View GitHub Profile
@xhezairbey
xhezairbey / auth.js
Created March 6, 2023 06:06 — forked from zolotyx/auth.js
Nuxt Auth Redirect Fix
export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isRelativeURL = u =>
u && u.length && /^\/[a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*[?]?([^#]*)#?([^#]*)$/.test(u)
export default function ({ app }) {
const redirect = function (name, noRouter = false) {
if (!this.options.redirect) {
return
}
@xhezairbey
xhezairbey / .php-cs-fixer.dist.php
Created July 23, 2022 11:40 — forked from tabacitu/.php-cs-fixer.dist.php
PHP-CS-Fixer Configuration File for the Laravel Code Style
<?php
/**
-----------------------------------------------------
Enforce the Laravel Code Style using PHP CS Fixer 3.x
-----------------------------------------------------
Credits go to Laravel Shift & Andreas Elia.
https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
@xhezairbey
xhezairbey / AES256Cipher.java
Created March 15, 2020 04:44 — forked from dealforest/AES256Cipher.java
AES256 encryption on Android
package net.dealforest.sample.crypt;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
@xhezairbey
xhezairbey / 1 dist.config.php
Created March 4, 2020 14:59 — forked from airways/1 dist.config.php
Simple, single ExpressionEngine configuration file to override almost all paths and server settings. As used by @airways and @litzinger.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Simple, single configuration file to override almost all paths and server settings. As used by @airways
// and @litzinger.
// Only check in the default as dist.config.php, set your version control system to ignore config.php so that
// local users and each instance (staging, production) can have their own settings.
// These config files are mainly meant to be used on a shared development server used by all developers,
// although it works almost as well for local development as well.
@xhezairbey
xhezairbey / aes_enc_dec.php
Created December 10, 2019 23:15 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@xhezairbey
xhezairbey / mcnojs+customjs.html
Created May 2, 2019 01:20 — forked from jasperf/mcnojs+customjs.html
MailChimp Form without MailChimp JS + Custom JS Redirect
<div id="wp-subscribe" class="wp-subscribe-wrap wp-subscribe wp-subscribe-1">
<h4 class="title">Like What You're Reading?</h4>
<p class="text">Subscribe to our mailing list and get blog posts sent directly to your e-mail inbox.</p>
<!-- Begin MailChimp Signup Form -->
<style type="text/css">
#mc_embed_signup{background:#f47555; clear:left; font:14px Helvetica,Arial,sans-serif; }/* Add your own MailChimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */#mc_embed_signup_scroll input{ background-color: #aaaaaa;border-color: #FFFFFF !important;<br />}input#mc-embedded-subscribe.button {height:50px;}</style>
<div id="mc_embed_signup"><form id="mc-embedded-subscribe-form" class="validate" action="//publiqly.us14.list-manage.com/subscribe/post?u=5e08d0ec976ea8929c31531bc&id=72b16de3f4" method="post" name="mc-embedded-subscribe-form" novalidate="" target="_blank">
<div id="mc_embed_signup_scroll">
<div clas
@xhezairbey
xhezairbey / Permission.java
Created April 12, 2018 23:20 — forked from droibit/Permission.java
Helper class for runtime permission of Android M
import android.Manifest;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.NonNull;
@xhezairbey
xhezairbey / MyApp.java
Created July 27, 2017 04:11 — forked from artem-zinnatullin/MyApp.java
If you need to set one font for all TextViews in android application you can use this solution. It will override ALL TextView's typefaces, includes action bar and other standard components, but EditText's password font won't be overriden.
public class MyApp extends Application {
@Override
public void onCreate() {
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/Roboto-Regular.ttf"); // font from assets: "assets/fonts/Roboto-Regular.ttf
}
}
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
@xhezairbey
xhezairbey / maintenance.php
Created March 8, 2017 22:52
OSclass Theme Maintenance File
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }