Skip to content

Instantly share code, notes, and snippets.

View nicolasverlhiac's full-sized avatar

Nicolas Verlhiac nicolasverlhiac

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
// when the button is clicked, this function will fire
function get_json_data() {
// get HTML tag ID of the databox that will show the result we get & put it as a variable called 'databox'
var databox = document.getElementById("databox");

Install ffmpeg with ALL includes

brew install ffmpeg $(brew options ffmpeg | grep -vE '\s' | grep -- '--with-' | tr '\n' ' ')

Cut video from 00:00:43 sec to 00:00:58 sec (15 sec duration).
Resize it to 720p.
Max quality options, but small size.

MP4

With audio:

@nicolasverlhiac
nicolasverlhiac / language-detect.php
Created November 23, 2015 15:50 — forked from LucaRosaldi/get-browser-language-code.php
PHP: Detect Browser Language
<?php
/**
* Gets the user’s browser language, given an array of avalaible languages.
* @param array $availableLanguages avalaible languages for the site
* @param string $default default language for the site
* @return string language prefix
*/
function get_client_language( $availableLanguages, $default='en' ){
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
@nicolasverlhiac
nicolasverlhiac / http_accept_language.php
Created November 23, 2015 15:49 — forked from humantorch/http_accept_language.php
Compare supported languages with HTTP_ACCEPT_LANGUAGE in a users' browser.
<?php
// Languages we support
$available_languages = array("zh-cn", "ca", "es", "fr", "af","nl", "sp", "en");
$default_language = "en"; // a default language to fall back to in case there's no match
function prefered_language($available_languages, $http_accept_language) {
global $default_language;
$available_languages = array_flip($available_languages);
@nicolasverlhiac
nicolasverlhiac / ProductController.php
Created November 23, 2015 14:18 — forked from prestarocket/ProductController.php
Prestashop : Override Product controller : array feature with id feature as key
<?php
class ProductController extends ProductControllerCore
{
public function initContent()
{
FrontController::initContent();
if (!$this->errors)
@nicolasverlhiac
nicolasverlhiac / .gitignore
Created November 23, 2015 14:18 — forked from prestarocket/.gitignore
Prestashop 1.6 gitignore
.buildpath
.project
.settings
.idea
.svn
.DS_Store
.sass-cache
config.codekit
*.sublime-project
*.sublime-workspace
// iMacro CheatSheet - Command Reference
// http://wiki.imacros.net/Command_Reference
// iMacros supports 3 types of variables:
// * The macro variables !VAR0 thru !VAR9. They can be used with the SET and ADD command inside a macro.
// * Built-in variables. They contain certain values set by iMacros.
// * User-defined variables. They are defined in-macro using the SET command.