Skip to content

Instantly share code, notes, and snippets.

@HasStacey
HasStacey / JS Countdown timer with PHP variables
Last active August 16, 2020 08:30
Create a JS countdown timer driven by PHP variables
<?php
$year = 2014;
$month = 10;
$day = 21;
$hour = 14;
$min = 00;
$sec = 00;
$target = mktime($hour, $min, $sec, $month, $day, $year);
$current = time();
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@edin-m
edin-m / html5-video-play-file-blob.html
Last active May 17, 2024 07:45
HTML video play file blob object url
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<video></video>
<br/>
<input type="file" name="file" id="fileItem" onchange="onChange()" >
@nucreativa
nucreativa / spinner.html
Created May 26, 2015 08:18
Simple CSS Spinner
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<style>
.spinner {
margin: 100px auto;
@cmpscabral
cmpscabral / download.php
Last active April 11, 2021 22:39
on the fly zip stream download
<?php
//
// taken from http://stackoverflow.com/questions/4357073/on-the-fly-zipping-streaming-of-large-files-in-php-or-otherwise
//
// make sure to send all headers first
// Content-Type is the most important one (probably)
//
header('Content-Type: application/octet-stream');
header('Content-disposition: attachment; filename="file.zip"');
storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
@rubenve
rubenve / hhvm-3.2-centos-plesk.txt
Last active May 8, 2018 06:20
Installing HHVM 3.2.0 on CentOS 6 with Plesk 11.5
# How to install the hhvm package using yum on CentOS 6.6 with Plesk 11.5
# Note that you can also install hhvm from source. For that check the official guides here:
# https://github.com/facebook/hhvm/wiki/Building-and-installing-HHVM-on-CentOS-6.6#13-install-ocaml
cd /etc/yum.repos.d
sudo wget http://www.hop5.in/yum/el6/hop5.repo
yum clean all
@joashp
joashp / openssl_encrypt_decrypt.php
Created September 4, 2015 15:59
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@fevangelou
fevangelou / default.vcl_PREFACE.md
Last active December 7, 2024 16:44
The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

Updated on December 15th, 2021

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites. It obviously depends on your use case.

@rjof
rjof / udemy.py
Created January 24, 2016 02:32
udemy.com video extraction tool. Works only if you bought a course and obtain a valid cookie.
import re
import requests
import json
import urlparse
from sys import stderr
def connect(url):
""" Extract source from passed URL. """
headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0)"\