Skip to content

Instantly share code, notes, and snippets.

@osadan
osadan / switch-php-version.sh
Created January 1, 2023 10:40
script to switch between php version apache and cli
#!/bin/bash
echo "changeing from $2 to $4"
a2dismod php$2
a2enmod php$4
systemctl restart apache2
update-alternatives --set php /usr/bin/php$4
update-alternatives --set php /usr/bin/phar$4
update-alternatives --set phar.phar /usr/bin/phar.phar$4
#!/bin/bash
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php$1
apt-get install php$1-xdebug php$1-cli php$1-common php$1-json php$1-opcache php$1-mysql php$1-mbstring php$1-zip php$1-fpm php$1-intl php$1-simplexml php$1-gd
///pass desired php version as parameter for example 7.0 , 7.1
@osadan
osadan / commands.sh
Last active December 28, 2022 08:34
useful linux shell commands
# size of directory
du -sh <path>
#tar gz directory
tar -czvf target source
@osadan
osadan / replace_env.sh
Created December 25, 2022 13:41
sed code to switch .env attributes
#!/bin/bash
FILE_PATH=<env file path>
echo $1
ESCAPED_REPLACE=$(printf '%s\n' "$2" | sed -e 's/[\/&]/\\&/g')
echo $ESCAPED_REPLACE
sed -i \
-r "s/^($1=).*/\1$ESCAPED_REPLACE/" $FILE_PATH
grep -q -e "$1=$2" $FILE_PATH || echo $1=$2 >> $FILE_PATH
@osadan
osadan / store.js
Created March 23, 2022 08:50
one store for multiple package instances
import "regenerator-runtime/runtime";
import { combineReducers, applyMiddleware, createStore,compose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import dynamicMiddlewares from 'redux-dynamic-middlewares';
import { composeWithDevTools } from 'redux-devtools-extension';
import { all } from 'redux-saga/effects';
const defaultConfig = {
reducersToSkipFromClearing: [],
@osadan
osadan / git-branch.txt
Created March 21, 2022 09:25
detect chnaged folders from git commi
BRANCH_POINT="$(git merge-base $(git rev-parse --abbrev-ref HEAD)
$(git describe origin/master))"
changedPackages="$(npx lerna ls -p --since $BRANCH_POINT --include-dependents)"
@osadan
osadan / gist:27843850be4a5d78b4131b713b2db19c
Last active March 21, 2022 09:21
npm next release publish
npm version prerelease --preid=next
npm publish --tag=next
@osadan
osadan / introrx.md
Created January 31, 2017 10:35 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
// Visual regression
http://responsivenews.co.uk/post/56884056177/wraith
https://www.npmjs.org/package/grunt-photobox
http://cburgmer.github.io/csscritic/
https://github.com/Huddle/PhantomCSS
http://siteeffect.io/
// CSS test
http://csste.st/techniques/
var safariDebug = ( navigator.platform.indexOf("iPhone") < 0 && navigator.platform.indexOf("iPod") < 0 && navigator.platform.indexOf("iPad") < 0 );
if(safariDebug)
{
PhoneGap.run_command = function()
{
if (!PhoneGap.available || !PhoneGap.queue.ready)
return;