Skip to content

Instantly share code, notes, and snippets.

@abderraouf-adjal
abderraouf-adjal / gnu_linux_links.txt
Last active October 8, 2022 16:51
روابط مفيدة حول جنو/لينكس
@EslaMx7
EslaMx7 / Resume FireFox Broken Downloads.py
Last active November 20, 2015 12:08
a small Python script to modify the URL of paused downloading file in FireFox, this is very useful while downloading big file from a server that giving you a very limited time for your IP, you just need to pause the current download and update the file URL with the new one with this script then restart the browser to see the changes and resume y…
__author__ = 'Eslam Hamouda | eslamx.com'
import configparser
import os.path
import json
import io
# get the required files paths to access Firefox AppData
win_user_profile = os.getenv('USERPROFILE')
@no1k
no1k / index.php
Last active December 24, 2023 09:38
Single image upload PHP
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Single Upload Form with PHP</title>
</head>
<body>
<form method="POST" action="upload.php" enctype="multipart/form-data">
<label for="file"> Pick a file : </label>
@Pushplaybang
Pushplaybang / rgb_to_hex_to_rgb.php
Created April 22, 2013 06:35
php functions convert hex to rgb and rgb to hex
function hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
@AmmarCodes
AmmarCodes / Sublime Text Useful Packages.md
Last active December 14, 2015 15:19
Collection of useful packages for web development
@marijn
marijn / unshorten.php
Created October 16, 2012 20:52
Unshorten URLS with PHP and CURL
<?php
/**
* @link http://jonathonhill.net/2012-05-18/unshorten-urls-with-php-and-curl/
*/
function unshorten_url($url) {
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_FOLLOWLOCATION => TRUE, // the magic sauce
CURLOPT_RETURNTRANSFER => TRUE,
@danny-englander
danny-englander / jquery.responsive-classes.js
Created September 13, 2012 00:16
JQuery Responsive Classes
/*
* Inspired by:
* http://designedbythomas.co.uk/blog/how-detect-width-web-browser-using-jquery
*
* This script is ideal for getting specific class depending on device width
* for enhanced theming. Media queries are fine in most cases but sometimes
* you want to target a specific JQuery call based on width. This will work
* for that. Be sure to put it first in your script file. Note that you could
* also target the body class instead of 'html' as well.
* Modify as needed
@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );