Skip to content

Instantly share code, notes, and snippets.

@sdiama
sdiama / update_c9_to_php7.1.sh
Last active January 23, 2019 17:35
Upgrade Cloud9 (c9) to php v7.1
sudo apt-get update -y
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.1-curl php7.1-cli php7.1-dev php7.1-gd php7.1-intl php7.1-mcrypt php7.1-json php7.1-mysql php7.1-opcache php7.1-bcmath php7.1-mbstring php7.1-soap php7.1-xml php7.1-zip -y
sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak
sudo apt-get remove libapache2-mod-php5 -y
sudo apt-get install libapache2-mod-php7.1 -y
@sdiama
sdiama / update_c9_to_php7.0.sh
Created January 23, 2019 17:35
Upgrade Cloud9 (c9) to php v7.0
sudo apt-get update -y
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.0-curl php7.0-cli php7.0-dev php7.0-gd php7.0-intl php7.0-mcrypt php7.0-json php7.0-mysql php7.0-opcache php7.0-bcmath php7.0-mbstring php7.0-soap php7.0-xml php7.0-zip -y
sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak
sudo apt-get remove libapache2-mod-php5 -y
sudo apt-get install libapache2-mod-php7.0 -y
@sdiama
sdiama / webview.js
Created May 29, 2019 17:47
React Native: Handle hardware back button @ webview
import React, { Component } from 'react';
import { WebView, BackHandler } from 'react-native';
export default class WebViewMoviezSpace extends Component {
constructor(props) {
super(props);
this.WEBVIEW_REF = React.createRef();
}
componentDidMount() {
@sdiama
sdiama / althosting.txt
Last active October 13, 2023 21:00
A curated list of cheap "alternatives" to AWS, GCP, Azure hosting solutions
S3 Alternatives
---------------
- https://wasabi.com
- https://www.exoscale.com
- https://www.vultr.com
- https://www.arubacloud.com/
- https://www.digitalocean.com
- https://min.io/
- http://leo-project.net/
- https://www.backblaze.com/
@sdiama
sdiama / autoSizeText.js
Created May 19, 2020 09:15
Auto size text to fit within a container
/**
* @param {string} inSelector - The selector containing text to auto size.
*/
window.autoSizeText = function(inSelector) {
var el, elements, _i, _len, _results;
elements = $(inSelector);
if (elements.length < 0) {
return;
}
@sdiama
sdiama / adBlockDetect.html
Created May 19, 2020 10:05
Check if Adblock is present - Simple and Effective
<div class="adsbygoogle mycontent">This is my content</div>
<script>
setTimeout( function() {
if ( $('.mycontent').length > 0 ) {
if ( $('.mycontent').is(":hidden") || ! $(".mycontent").length ) {
alert('AdBlock Detected');
}
}
}, 1000);
@sdiama
sdiama / custom1.m3u
Last active August 19, 2024 06:53
Custom Playlist 1
#EXTM3U
#EXTINF:-1 tvg-id="" tvg-name="" tvg-language="Hindi" tvg-logo="https://sportzwiki.com/wp-content/uploads/2016/07/Star-Sports.png" tvg-country="IN" tvg-url="" group-title="Sport",STAR SPORTS INDIA
https://www.youtube.com/watch?v=OByvQ3Qbhcc
#EXTINF:-1 tvg-id="" tvg-name="" tvg-language="" tvg-logo="https://images-na.ssl-images-amazon.com/images/I/71eK1Q3-dbL._AC_SL1500_.jpg" tvg-country="UN" tvg-url="" group-title="Uncategorized",NASA Live Stream Earth From Space / Real ISS Live Feed
https://www.youtube.com/watch?v=lx2CNP7kwhI
#EXTINF:-1 tvg-id="" tvg-name="" tvg-language="" tvg-logo="https://images-na.ssl-images-amazon.com/images/I/71eK1Q3-dbL._AC_SL1500_.jpg" tvg-country="UN" tvg-url="" group-title="Uncategorized",NASA Live Official Stream of NASA TV
https://www.youtube.com/watch?v=21X5lGlDOfg
#EXTINF:-1 tvg-id="" tvg-name="" tvg-language="" tvg-logo="https://images-na.ssl-images-amazon.com/images/I/71eK1Q3-dbL._AC_SL1500_.jpg" tvg-country="UN" tvg-url="" group-title="Uncategorized",NASA Live Offic
@sdiama
sdiama / laravel-cloudflare
Created May 20, 2021 08:43
Get Real Client IP Behind Cloudflare in Laravel
/*
* @ AppServiceProvider add...
*/
use Symfony\Component\HttpFoundation\Request;
public function boot() {
/* This line set the Cloudflare's IP as a trusted proxy
Request::setTrustedProxies(
['REMOTE_ADDR'],
@sdiama
sdiama / LaravelExtensions.txt
Last active January 28, 2022 19:56
A list of must-install extensions for every Laravel project
- https://github.com/barryvdh/laravel-ide-helper
- https://github.com/barryvdh/laravel-debugbar
- https://github.com/beyondcode/laravel-query-detector
- https://github.com/spatie/laravel-backup
- https://github.com/glhd/laravel-dumper
@sdiama
sdiama / laravelUpdateFieldOnce.php
Last active February 7, 2022 23:40
Laravel: Update a DB field only once
class Mymodel extends Model
{
public function setMyfieldAttribute($value)
{
if ($this->myfield) {
return;
}
$this->attributes['myfield'] = $value;
}