View generate-file-dirs.php
<?php | |
foreach (new DirectoryIterator('files/') as $file) { | |
if ($file->isFile()) { | |
$file_name = $file->getFilename(); | |
$name = strtolower($file_name); | |
$letter1 = $name[0]; | |
$letter2 = $name[1]; | |
// Create first directory | |
if (!file_exists('media/downloadable/files/links/' . $letter1)) { |
View create-file-product-association-script.php
<?php | |
function csv_to_array($filename='', $delimiter=',') | |
{ | |
if(!file_exists($filename) || !is_readable($filename)) | |
return FALSE; | |
$header = NULL; | |
$data = array(); | |
if (($handle = fopen($filename, 'r')) !== FALSE) | |
{ |
View entity_id-product_name.sql
select cpev.entity_id as entity_id, cpev.value as product_name from catalog_product_entity_varchar as cpev | |
join eav_attribute as ea on cpev.attribute_id = ea.attribute_id | |
join eav_entity_type as eet on ea.entity_type_id = eet.entity_type_id | |
join catalog_product_entity as cpe on cpe.entity_id = cpev.entity_id | |
where ea.attribute_code = 'name' | |
and eet.entity_type_code = 'catalog_product' | |
and cpe.type_id = 'downloadable'; |
View show-tables-with-prefix.sql
SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = 'databasename' | |
AND table_name LIKE 'prefix%'; | |
SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = 'databasename' | |
AND table_name NOT LIKE 'prefix%'; |
View CustomNotification.php
<?php | |
//Store specific variables for the URL | |
$secretKey = "YourSecretKey"; | |
$storeId = YourNumericalStoreId; | |
//This is declaring variables for the notification mail function | |
$subject = "Notification Subject"; | |
$mailheader = "From: someone@yourwebpage.com \r\n"; |
View gist:5670980
source "https://rubygems.org" | |
ruby "1.9.3" | |
# Bundle edge Rails instead: | |
# gem 'rails', :git => 'git://github.com/rails/rails.git' | |
gem 'sqlite3' | |
# Gems used only for assets and not required |
View gist:5671035
Ceilis-MacBook-Pro:colormyi ceili$ git push heroku master | |
Counting objects: 882, done. | |
Delta compression using up to 2 threads. | |
Compressing objects: 100% (746/746), done. | |
Writing objects: 100% (882/882), 3.87 MiB | 536 KiB/s, done. | |
Total 882 (delta 49), reused 0 (delta 0) | |
-----> Ruby/Rails app detected | |
-----> Using Ruby version: ruby-1.9.3 | |
-----> Installing dependencies using Bundler version 1.3.2 |
View getfiles
#!/bin/bash | |
while read -r line; do | |
file=$(echo "$line" | awk -F'\t' '{ print $1 }') | |
[[ $file == 'connecting to'* ]] && continue | |
file_id="$(cut -d'|' -f1 <<<"$file")" | |
file_key="$(cut -d'|' -f2 <<<"$file")" | |
mkdir $file_id && cd "$_" | |
mongofiles -d meteor --prefix="cfs_gridfs.filesStore" get_id 'ObjectId("'$file_key'")' |
View before.php
<div class="list-article-thumb"> | |
<a href="<?php echo esc_url( get_permalink() ); ?>"> | |
<?php | |
if ( has_post_thumbnail( ) ) { | |
the_post_thumbnail(); | |
} else { | |
echo '<img alt="" src="'. get_template_directory_uri() . '/images/placeholder.png' .'">'; | |
} | |
?> | |
</a> |
View after.php
<div class="list-article-thumb"> | |
<a href="<?php echo esc_url( get_permalink() ); ?>"> | |
<?php | |
if ( has_post_thumbnail( ) ) { | |
the_post_thumbnail(); | |
} else { | |
$images_iterator = new FilesystemIterator( | |
WP_CONTENT_DIR . '/themes/yourthemename/images/', | |
FilesystemIterator::SKIP_DOTS | |
); |