Skip to content

Instantly share code, notes, and snippets.

View eznix86's full-sized avatar
🎯
Focusing

Bruno Bernard eznix86

🎯
Focusing
View GitHub Profile
/* PAGINATION WITH SORTING AND PAGING */
const page = 1; // input page, min value 1
const limit = 2; // input limit min value 1
/* INPUT ARRAY */
const array = [
{ Editable: true, Name: "Daniel Test", Site: "SE100"},
{ Editable: true, Name: "Test new", Site: "SE100"},
{ Editable: false, Name: "Test", Site: "SE100"},
];
@eznix86
eznix86 / android-screen-to-gif.sh
Last active April 2, 2019 14:15 — forked from lorenzos/android-screen-to-gif.sh
Captures screen from Android device via ADB and makes a high quality GIF
#!/bin/bash
# based on http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
#
# How to install:
# Install adb
# sudo apt-get install ffmpeg
# wget https://gist.github.com/theArtechnology/d012fdb3e46166cb1f92b81a1d956535/raw/android-screen-to-gif.sh
# chmod a+x android-screen-to-gif.sh
@eznix86
eznix86 / main.dart
Created July 6, 2019 11:10 — forked from AdamJonsson/main.dart
An example how different widget can be used to expand and collapse content in Flutter
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Expanding Demo',
theme: ThemeData(
@eznix86
eznix86 / app.js
Created October 9, 2019 20:06 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
FROM node
RUN mkdir -p /usr/src/app
COPY index.js /usr/src/app
EXPOSE 8080
CMD [ "node", "/usr/src/app/index" ]
@eznix86
eznix86 / .gitlab-ci.yml
Created December 21, 2019 21:47
Flutter gitlab pipeline
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
FLUTTER_VERSION: "https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.12.13+hotfix.5-stable.tar.xz"
before_script:
- apt-get --quiet update --yes
@eznix86
eznix86 / bash.sh
Last active December 26, 2019 07:30
command to to add a pre-push script in git
cat <<EOF >> .git/hooks/pre-push
#!/usr/bin/php
<?php
function run(\$title, \$command) {
echo "+ Starting \$title".PHP_EOL;
exec("\$command", \$output, \$returnCode);
if ($returnCode !== 0) {
foreach (\$output as \$line) {
@eznix86
eznix86 / phpstorm-cs-fixer.md
Created December 24, 2019 13:10 — forked from nienkedekker/phpstorm-cs-fixer.md
Set up PHP-CS-Fixer in PHPStorm

Use PHP-CS-Fixer in PHPStorm

  • Install PHP-CS-Fixer on your local machine according to these instructions: https://github.com/FriendsOfPHP/PHP-CS-Fixer
  • Open PHPStorm, Preferences > Tools > External Tools and enter these values: img
  • Program, edit to match your path where PHP-CS-Fixer lives: /.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
  • Parameters: --rules=@PSR2 --verbose fix $FileDir$/$FileName$. Note that previous verions of PHP-CS-Fixer used --levels instead of --rules.
  • Working directory: $ProjectFileDir$

Click OK and Apply. Now we'll set up a shortcut.

  • Go to Preferences > Keymap and search for "PHP Fixer" (or whatever name you gave it). Add whatever shortcut you like, I'm using ctrl + cmd + ]:
@eznix86
eznix86 / fork-a-branch.sh
Created March 26, 2020 06:08 — forked from benbalter/fork-a-branch.sh
How to fork a single branch of a repo, preserving commit log
mkdir target-repo
cd target-repo
git init
git remote add origin git@github.com...
git remote add upstream git@github.com....
git fetch upstream
git pull upstream master
git push origin master
Alternative:
@eznix86
eznix86 / error-404-page-not-found-80s-hacker-theme.markdown
Created May 7, 2020 11:35
Error 404: Page not found – 80s hacker theme