Skip to content

Instantly share code, notes, and snippets.

View technoknol's full-sized avatar
🎯
Focusing

Technoknol technoknol

🎯
Focusing
View GitHub Profile
@bezenson
bezenson / toggleListItem.js
Last active October 2, 2020 06:51
Toggle item in array with ramda
import { append, contains, curry, ifElse, without } from 'ramda';
const toggleListItem = curry((value, list) => ifElse(
contains(value),
without([value]),
append(value),
)(list));
// 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
tonY1883 / ValidateYoutubeVideoId.js
Created September 14, 2017 02:18
A small trick to check if youtube video exist with its id.
function validVideoId(id) {
var img = new Image();
img.src = "http://img.youtube.com/vi/" + id + "/mqdefault.jpg";
img.onload = function () {
checkThumbnail(this.width);
}
}
function checkThumbnail(width) {
//HACK a mq thumbnail has width of 320.
@jeffochoa
jeffochoa / 1.ProcessClass.php
Last active April 23, 2024 21:22
Understanding Laravel pipelines
<?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
@geraldvillorente
geraldvillorente / import.md
Created June 14, 2017 05:03
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

@mavieth
mavieth / install-php-7.sh
Created May 2, 2017 01:38
Upgrade from PHP 5.X.X to PHP 7 on an AWS EC2 Linux Server
#!/bin/bash
echo "==============================="
echo "Installing PHP 7"
echo "==============================="
sudo yum install php70
echo "==============================="
echo "Installing PHP 7 additional commonly used php packages"
echo "==============================="
@sadikaya
sadikaya / git-bash-in-webstorm.md
Last active February 13, 2024 01:23
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
alexsasharegan / .htaccess
Created September 7, 2016 00:36
Apache Config for React Router
<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]
@odan
odan / xampp_php7_xdebug.md
Last active April 17, 2024 05:36
Installing Xdebug for XAMPP
@rheinardkorf
rheinardkorf / Hooks.js
Last active April 2, 2024 09:49
Simple WordPress like hooks system for JavaScript.
/**
* @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.
*