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 | |
/** | |
* This function looks for the directory that "wp-config.php" resides in | |
* and then looks for a file named ".revision", the content of which is a | |
* single integer set by Beanstalk upon deployment. | |
* | |
* The purpose is to version static resources so that browsers will | |
* re-download any cached, outdated versions with the newer version. | |
* |
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 | |
function auto_login() { | |
if (!is_user_logged_in()) { | |
//determine WordPress user account to impersonate | |
$user_login = 'anonymous'; | |
//get user's ID | |
$user = get_userdatabylogin($user_login); | |
$user_id = $user->ID; |
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
def generate_secure_s3_url(s3_key) | |
# | |
# s3_key would be a path (including filename) to the file like: "folder/subfolder/filename.jpg" | |
# but it should NOT contain the bucket name or a leading forward-slash | |
# | |
# this was built using these instructions: | |
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?S3_QSAuth.html | |
# http://aws.amazon.com/code/199?_encoding=UTF8&jiveRedirect=1 | |
s3_base_url = MyApp::Application::S3_BASE_URL # i.e. https://mybucket.s3.amazonaws.com |
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
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
# Download the compiled elasticsearch rather than the source. | |
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz | |
rm elasticsearch.tar.gz | |
sudo mv elasticsearch-* elasticsearch | |
sudo mv elasticsearch /usr/local/share |
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
function getAudioData (url, time) { | |
return new Promise(function (resolve, reject) { | |
var context = new AudioContext(); | |
var track = new Audio(url); | |
var bufferLength = time * context.sampleRate; | |
var buffer = new Float32Array(bufferLength); | |
var collector = context.createScriptProcessor(0, 1); | |
var audioSource = context.createMediaElementSource(track); | |
var samplesCollected = 0; |
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
server { | |
listen 80; | |
root /var/www/craft.dev/public; | |
index index.php index.html index.htm; | |
server_name craft.dev; | |
location / { | |
try_files $uri $uri/ @rewrites; |
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
/* | |
Auto-version CSS & JS files, allowing for cache busting when these files are changed. | |
Place in functions.php or wherever you are enqueueing your scripts & styles | |
Avoids using query strings which prevent proxy caching | |
Adjust paths based on your theme setup. These paths work with Bones theme | |
*/ |
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
Route::get('edit', function() { | |
// fetch our post, and it's associated categories | |
$post = Post::with('cats')->where('id', '=', $id)->first(); | |
// fetch all of our categories | |
$cats = Cat::all(); | |
// create our empty array | |
$post_cats = array(); |
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: Single user login | |
Plugin URI: | |
Description: | |
Author: Ben May | |
Author URI: | |
Version: 0.1 | |
*/ |
OlderNewer