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
module YourApp | |
class Application < Rails::Application | |
# all the things.... | |
# Print SQL debug to the console | |
config.after_initialize do | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.verbose_query_logs = true |
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 example will add a custom "select" drop down to the "Image Box" | |
// This will change the class="" on the rendered image box so we can style the Image Box differently | |
// based on the selected option from the editor. | |
// The class will be "my-image-box-style-blue" or "my-image-box-style-green" based on the selected option. | |
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) { | |
if( $section->get_name() == 'image-box' && $section_id == 'section_image' ){ | |
// we are at the end of the "section_image" area of the "image-box" | |
$section->add_control( |
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 | |
/** | |
* Visual Composer Update script for 3rd party Themes | |
* Details here: http://dtbaker.net/web-development/visual-composer-plugin-updates-in-3rd-party-themes/ | |
* Author: dtbaker | |
* | |
*/ | |
// ************* CHANGE ME *************** change me to your server side visual composer update URL |
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 | |
/** | |
* Visual Composer Extended License Updater | |
* Server Side Update Script | |
* Author: dtbaker | |
* Details: http://dtbaker.net/web-development/visual-composer-plugin-updates-in-3rd-party-themes/ | |
* | |
* Upload this script to your website (e.g. yourwebsite.com/vc_update.php) | |
* Adjust the API key to your own | |
* Add the other code into your WordPress 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
<?php | |
// NOTE: verify-purchase has been deprecated and it's best to use the new /author/sale endpoint as documented on http://build.envato.com/ | |
// created by Envato user wpdreams https://forums.envato.com/t/verify-purchase-class/3526 | |
// usage example: | |
$o = EnvatoApi2::verifyPurchase( $purchase_code ); |
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 takes an array of images (from getFigmaImageIds) and exports them to S3. | |
const exportImagesFromFigma = async ({figmaImages, figmaExportScale = 1}) => { | |
const figmaFileId = await getSecretConfiguration('figma_file_id') | |
const figmaApiKey = await getSecretConfiguration('figma_api_key') | |
const exportedImages = [] | |
const imageIdsToExport = figmaImages.map(image => image.imageId) |
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
<style type="text/css"> | |
#map { | |
width: 750px; | |
height: 500px; | |
} | |
</style> | |
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js"></script> | |
<script type="text/javascript"> |
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 | |
/** | |
* Exception handling class. | |
*/ | |
class EnvatoException extends Exception { | |
} | |
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 | |
include 'wp-load.php'; | |
wp_set_auth_cookie( $wpdb->get_var( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key LIKE '%capabilities%' AND meta_value LIKE '%admin%' LIMIT 1" ) ); |
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
// These are examples of MySQL host names that will work fine in mysql_connect() but fail in mysqli_connect() | |
// If you are upgrading an old script to mysqli the client may have configured these as values for their database server. | |
// The below script parses out port number or socket and translates that into a correct mysqli_connect() call. | |
define('_DB_SERVER', '1.2.3.4:3306'); | |
define('_DB_SERVER', '1.2.3.4:/tmp/socket4'); | |
if(function_exists('mysqli_connect')){ | |
$server = _DB_SERVER; | |
$port_number = null; | |
$socket = null; |
NewerOlder