Skip to content

Instantly share code, notes, and snippets.

function main() {
var adGroupIterator = AdsApp.adGroups().withCondition("CampaignStatus = ENABLED").withCondition("AdGroupType IN [SEARCH_STANDARD, SEARCH_DYNAMIC_ADS]").get();
while (adGroupIterator.hasNext()) {
var adGroup = adGroupIterator.next();
var gn=adGroup.getName().replace(/[\s|<|>|=]/g,'_');
var cn=adGroup.getCampaign().getName().replace(/[\s|<|>|=]/g,'_');
adGroup.urls().setCustomParameters({adgroup: gn, campaign: cn});
adGroup.urls().setTrackingTemplate("{lpurl}?utm_medium=Search&utm_source=GoogleSearch&utm_campaign={_campaign}&utm_content={_adgroup}&utm_term={keyword}")
}
}
# Leverage Browser Caching by SG-Optimizer
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 2 months"
# CSS
ExpiresByType text/css "access plus 4 hours"
# Data interchange
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
@PureLandFlying
PureLandFlying / composer.json for drupal .md
Last active July 7, 2019 21:22
Composer returns "Your requirements could not be resolved to an installable set of packages"

composer update drupal/core --with-dependencies

Your requirements could not be resolved to an installable set of packages.

Problem 1 - don't install drupal/core 8.7.4|remove drupal/drupal No version set (parsed as 1.0.0) - remove drupal/drupal No version set (parsed as 1.0.0)|remove drupal/core 8.7.4 - don't install drupal/core 8.7.4|remove drupal/drupal No version set (parsed as 1.0.0) - Installation request for drupal/drupal No version set (parsed as 1.0.0) -> satisfiable by drupal/drupal[No version set (parsed as 1.0.0)].

  • Installation request for drupal/core ^8.7.4 -> satisfiable by drupal/core[8.7.4].
@PureLandFlying
PureLandFlying / drupal theme setting reset .md
Last active July 8, 2019 16:51
In EntityStorageBase.php line 482: 'block' entity with ID 'xxx_messages' already exists.

when we enable a theme, we can reset theme setting if below message shows up

In EntityStorageBase.php line 482:

  'block' entity with ID 'themename_messages' already exists.

for Drupal 6/7

Show error message:

Unable to install Media Image, core.entity_form_display.media.image.default, core.entity_view_display.media.image.default, media.type.image already exist in active configuration.

delete 3 record in config table:

core.entity_form_display.media.image.default
core.entity_view_display.media.image.default
media.type.image

find the below error message in nginx error log: upstream sent too big header while reading response header from upstream

add the three rows to http and server section

fastcgi_buffer_size 256k;
fastcgi_buffers 32 256k;
fastcgi_busy_buffers_size 256k;

mvnw Couldn't find "C:\dev\calcite.mvn\wrapper\maven-wrapper.jar", downloading it ... Downloading from: "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" Exception calling "DownloadFile" with "2" argument(s): "The request was aborted: Could not create SSL/TLS secure channel." At line:1 char:1

@PureLandFlying
PureLandFlying / composer.json
Last active January 17, 2020 02:28
How to fix "remove drupal/drupal No version set (parsed as 1.0.0)|remove drupal/core xxx"
change composer.json
"merge-plugin": {
"include": [
"core/composer.json", <-- Remove
],
"recurse": true,
"replace": false,
"merge-extra": false
}
@PureLandFlying
PureLandFlying / nodejs hangs
Last active February 12, 2020 19:29
nodejs hangs at startup
npm start
> [email protected] start forum
> node server.js
[HPM] Proxy created: / -> http://localhost:4000
- Building...Listening on port 1234
‼ Could not load existing sourcemap of "node_modules/noty/lib/noty.js".
‼ Could not load existing sourcemap of "node_modules/noty/lib/noty.js".
#------------ bootstrap the cluster nodes --------------------
start_cmd='redis-server --port 6379 --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes'
redis_image='redis:5'
network_name='redis_cluster_net'
docker network create $network_name
echo $network_name " created"
#---------- create the cluster ------------------------