Skip to content

Instantly share code, notes, and snippets.

View Kreshnik's full-sized avatar

Kreshnik Hasanaj Kreshnik

View GitHub Profile
@Kreshnik
Kreshnik / AnimateCamera.jsx
Created March 14, 2024 19:30 — forked from ektogamat/AnimateCamera.jsx
useGSAP with React Three Fiber Camera Animation
import { useThree } from '@react-three/fiber'
import { gsap } from 'gsap'
import { useGSAP } from '@gsap/react'
export default function AnimateCamera() {
// Accessing camera from Three.js
const { camera } = useThree()
useGSAP(() => { // The new hook will take care of context and life cicle.
gsap.fromTo( // Creates the animation
@Kreshnik
Kreshnik / index.js
Last active March 18, 2022 19:12
Receive SMS through SMPP with NodeJS
var smpp = require('smpp');
var session = smpp.connect('smpp://SEVER_IP');
var request = require('request');
var connected = false;
session.on('connect', function () {
connected = true;
@Kreshnik
Kreshnik / laravel.sh
Last active July 19, 2016 08:46
A bash function to setup Laravel & DB.
function lara(){
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
printf "${GREEN}What is the name of the project:${NC}"
read PROJECT_NAME
if [ ! -z $PROJECT_NAME ]; # Check if project name is set.
then
@Kreshnik
Kreshnik / install.sh
Last active August 29, 2015 14:23
LAMP + Tools
#!/usr/bin/env bash
sudo apt-get update
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get install -y vim curl python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5
sudo apt-get update
@Kreshnik
Kreshnik / PreventReplayAttack.php
Last active November 6, 2024 14:25
Laravel 5 - PreventReplayAttack Middleware
<?php namespace App\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Cache\Repository as Cache;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Session;
class PreventReplayAttack
{
@Kreshnik
Kreshnik / dbcreate.js
Last active April 12, 2017 04:34
Gulp task to create a MySQL database
// Required npm packages: gulp, gulp-shell, gulp-prompt
// Usage: gulp db:create
var util = require('util');
var gulp = require('gulp');
var shell = require('gulp-shell');
var prompt = require('gulp-prompt');
gulp.task('db:create', function() {
gulp.src('').pipe(