Skip to content

Instantly share code, notes, and snippets.


Technoknol technoknol

View GitHub Profile
inferusvv / toggleListItem.js
Last active Oct 2, 2020
Toggle item in array with ramda
View toggleListItem.js
import { append, contains, curry, ifElse, without } from 'ramda';
const toggleListItem = curry((value, list) => ifElse(
// Example:
const data = ['a', 'b', 'c', 'd'];

Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
tonY1883 / ValidateYoutubeVideoId.js
Created Sep 14, 2017
A small trick to check if youtube video exist with its id.
View ValidateYoutubeVideoId.js
function validVideoId(id) {
var img = new Image();
img.src = "" + id + "/mqdefault.jpg";
img.onload = function () {
function checkThumbnail(width) {
//HACK a mq thumbnail has width of 320.
jeffochoa / 1.ProcessClass.php
Last active Sep 14, 2021
Understanding Laravel pipelines
View 1.ProcessClass.php
namespace App\Features;
use App\Features\FirstTask;
use App\Features\SecondTask;
use Illuminate\Pipeline\Pipeline;
// *Naming things is hard* ... So, this is a class called `ProcessClass` that `run()` some text ¯\_(ツ)_/¯
class ProcessClass
mavieth /
Created May 2, 2017
Upgrade from PHP 5.X.X to PHP 7 on an AWS EC2 Linux Server
echo "==============================="
echo "Installing PHP 7"
echo "==============================="
sudo yum install php70
echo "==============================="
echo "Installing PHP 7 additional commonly used php packages"
echo "==============================="
sadikaya /
Last active Nov 24, 2021
git bash inside Webstorm terminal

Go to File -> Settings -> Tools -> Terminal and change Shell path based on the the installed git version.

for 64bit:

"C:\Program Files\Git\bin\sh.exe" --login -i

for 32bit:

"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
alexsasharegan / .htaccess
Created Sep 7, 2016
Apache Config for React Router
View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
rheinardkorf / Hooks.js
Last active Jan 11, 2022
Simple WordPress like hooks system for JavaScript.
View Hooks.js
* @file A WordPress-like hook system for JavaScript.
* This file demonstrates a simple hook system for JavaScript based on the hook
* system in WordPress. The purpose of this is to make your code extensible and
* allowing other developers to hook into your code with their own callbacks.
* There are other ways to do this, but this will feel right at home for
* WordPress developers.
ivankristianto / resumeable-file-download.php
Created Dec 17, 2013
Resumeable File Download With PHP
View resumeable-file-download.php
function serve_file_resumable ($file, $contenttype = 'application/octet-stream') {
// Avoid sending unexpected errors to the client - we should be serving a file,
// we don't want to corrupt the data we send
// Make sure the files exists, otherwise we are wasting our time
if (!file_exists($file)) {
header("HTTP/1.1 404 Not Found");