Skip to content

Instantly share code, notes, and snippets.

@steventrux
steventrux / Chromecast batch conversion script
Last active May 27, 2021 22:56
A bash script to batch convert video files for chromecast compatibility
#! /bin/bash
# Batch Convert Script by StevenTrux
# The Purpose of this Script is to batch convert any video file to mp4 or mkv format for chromecast compatibility
# this script only convert necessary tracks if the video is already
# in H.264 format it won't convert it saving your time!
# Put all video files need to be converted in a folder!
# the name of files must not have " " Space!
# Rename the File if contain space
@zeuxisoo
zeuxisoo / php-fpm.sh
Last active October 25, 2018 17:19
php-fpm.sh (start,stop,restart,reload,test,status)
#!/bin/sh
PREFIX=/usr/local/php
PHP_FPM_BIN=${PREFIX}/sbin/php-fpm
PHP_FPM_CONF=${PREFIX}/etc/php-fpm.user.conf
PHP_FPM_PID=${PREFIX}/pid/php-fpm.user.pid
PHP_OPTIONS="--fpm-config $PHP_FPM_CONF"
#init
MOBILE_SDK=/Library/Application\ Support/Titanium/mobilesdk/osx/2.1.0.GA
ANDROID_SDK=/Users/ttp/Documents/Development/android-sdk-mac_x86
mkdir temp
mkdir dist
rm -r temp/*
rm -r dist/*
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active September 24, 2024 14:47
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@shirshir
shirshir / ExtendedMonologServiceProvider.php
Created January 14, 2014 08:39
A Silex Service Provider to add Monolog\Handler\BufferHandler, Monolog\Handler\FingersCrossedHandler and Symfony\Bridge\Monolog\Handler\SwiftMailerHandler to email any errors. Silex\Provider\MonologServiceProvider must also be registered.
<?php
namespace App\Provider;
use Monolog\Handler\BufferHandler;
use Monolog\Handler\FingersCrossedHandler;
use Monolog\Logger;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Bridge\Monolog\Handler\SwiftMailerHandler;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@jbonney
jbonney / spotify_keybindings
Created June 9, 2013 13:22
Spotify - Linux key bindings. From XFCE / Ubuntu keyboard shortcuts configuration, assign the control command to their key. http://shkspr.mobi/blog/2011/12/linux-spotify-keybindings/
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious
@alganet
alganet / tipagem_primitiva.md
Last active August 12, 2019 22:48
PHP Prático: Tipagem Primitiva

PHP Prático: Tipagem Primitiva

A primeira coisa a saber sobre a tipagem do PHP é que ela não é parecida com Java, JavaScript, Python, Ruby, C, C++, C# ou qualquer linguagem que tenha uma tipagem baseada em alguma dessas citadas. A tipagem do PHP é incomparável, e assim como tudo que não pode ser comparado é difícil de ser explicada.

De qualquer forma, a tipagem do PHP é extremamente simples se você apenas confiar na sua intuição. A primeira coisa que você tem que saber sobre a tipagem do PHP é que ela faz malabarismos. É exatamente essa a palavra: malabarismo. E o PHP é um ótimo malabarista, exceto por alguns poucos deslizes fáceis de decorar. O type juggling, traduzido para "malabarismo com tipos" é a habilidade que o PHP tem de tomar decisões intuitivas sobre conversões de tipos. Em termos grosseiros, o PHP decide toda e qualquer tipagem de variáveis em tempo de execução, não compilação (pros pedante aí que tão lendo).

Note bem: tipagem de variáveis. O PHP é multi-paradigma e, ao m

@ricardoalcocer
ricardoalcocer / index.js
Last active December 15, 2015 23:19
Android Holo Actionbar Alloy Sample Based on ideas by https://github.com/hoyo/ActionBarSample/tree/master/app
function doClickMenu(evt){
alert(evt.source.title);
}
// we need to do some things to the Window once it is properly instanciated, so we add an event listener to its OPEN event
$.win.addEventListener('open',function(){
var actionBar = $.win.activity.actionBar; // get a handle to the action bar
actionBar.title='My App'; // change the App Title
actionBar.displayHomeAsUp=true; // Show the "angle" pointing back
actionBar.onHomeIconItemSelected = function() { // what to do when the "home" icon is pressed
@alganet
alganet / greppy.php
Last active August 30, 2017 13:38
Greppy
<?php
// Simple empty matching. Explains a lot of how the idea works:
//
// By default, expressions are delimited by a line, which
// implies /^$/. Everything goes inside that. Calling nothing
// else more matches any line.
//
// p() is a function call. Could be Pattern::create(), but I
// believe providing a function is sane. It can be provided