This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
play_in_view: function() { | |
percent_of_video_visible = 0.2; | |
function check_videos_in_view() { | |
$('.ambient video').each(function() { | |
var x = $(this).offset().left, | |
y = $(this).offset().top, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// requires php5 | |
define('UPLOAD_DIR', 'images/'); | |
$img = $_POST['img']; | |
$img = str_replace('data:image/png;base64,', '', $img); | |
$img = str_replace(' ', '+', $img); | |
$data = base64_decode($img); | |
$file = UPLOAD_DIR . uniqid() . '.png'; | |
$success = file_put_contents($file, $data); | |
print $success ? $file : 'Unable to save the file.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats | |
# Change example.com (server_name) to your website url | |
# Change /path/to/your/root to the correct value | |
server { | |
listen 80; | |
server_name example.com; | |
root /path/to/your/root; | |
index index.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Multisite: Passwort Reset on Local Blog | |
* Plugin URI: https://gist.github.com/eteubert/293e07a49f56f300ddbb | |
* Description: By default, WordPress Multisite uses the main blog for passwort resets. This plugin enables users to stay in their blog during the whole reset process. | |
* Version: 1.0.0 | |
* Author: Eric Teubert | |
* Author URI: http://ericteubert.de | |
* License: MIT | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 && https://gist.github.com/xdamman/e4f713c8cd1a389a5917 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Add multiverse. Not all deps are in the main repo | |
sudo apt-add-repository multiverse && sudo apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('lostpassword_post', 'validate_reset', 99, 3); | |
function validate_reset(){ | |
if(isset($_POST['user_login']) && !empty($_POST['user_login'])){ | |
$email_address = $_POST['user_login']; | |
//is this an email reset? | |
if(filter_var( $email_address, FILTER_VALIDATE_EMAIL )){ | |
if(!email_exists( $email_address )){ | |
wp_redirect( $_POST['redirect_to'].'/register' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commands: | |
01_node_install: | |
# run this command from /tmp directory | |
cwd: /tmp | |
# don't run the command if node is already installed (file /usr/bin/node exists) | |
test: '[ ! -f /usr/bin/node ] && echo "node not installed"' | |
# install from epel repository | |
# flag -y for no-interaction installation | |
command: 'yum install -y nodejs --enablerepo=epel' | |
02_npm_install: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Declare an array of 4 elements | |
var data = [1,2,3,4]; // the ids coming back from serviceA | |
// 2. Declare an array of Deferred objects | |
var processItemsDeferred = []; | |
// 3. For each element of data, create a Deferred push push it to the array | |
for(var i = 0; i < data.length; i++){ | |
processItemsDeferred.push(processItem(data[i])); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<div id="square" style="background-color: #ccc; width:200px; height:140px;"> |