Skip to content

Instantly share code, notes, and snippets.

View weitzman's full-sized avatar

Moshe Weitzman weitzman

View GitHub Profile
@magickatt
magickatt / SomethingContext.php
Last active October 25, 2016 15:39
Save screenshot of a failed Behat step
<?php
/**
* @AfterStep
*/
public function takeScreenshotAfterFailedStep($event)
{
if ($event->getTestResult()->getResultCode() === \Behat\Testwork\Tester\Result\TestResult::FAILED) {
$driver = $this->getSession()->getDriver();
if ($driver instanceof \Behat\Mink\Driver\Selenium2Driver) {
@jaymcgavren
jaymcgavren / monkey_cherry_picking.md
Last active March 27, 2023 11:41
"Monkey cherry-picking": Freehand patching via Git and the clipboard...

I run a diff of my current branch versus a different one that has some stuff I want:

$ git diff HEAD subscribers_decorator | cat
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index 245393c..6a1639a 100644
...

Big 'ol list of stuff I don't want...

Followed by a portion that I do want... Which I manually copy.

@shadowhand
shadowhand / git-switchbranch
Created October 23, 2012 16:50
Fast git branch switcher
#!/bin/bash
usage() {
echo "usage: git switchbranch"
}
version() {
echo "switchbranch v0.0.2"
}
<?php
/**
* @file
*
* Generates a command XML file for PHPStorm/WebStorm/IntelliJ IDEs
* that provides integration with Drush
*/
/**
@Jach
Jach / mig.py
Created December 30, 2011 04:09
Dirty migration script from Jira issues to Github issues
'''
Steps:
1. Create any milestones
2. Create any labels
3. Create each issue, linking them to milestones and labels
3.1: Update status for new issue if closed
4: Create all the comments for each issue
'''
import getpass
import json
anonymous
anonymous / gist:1167900
Created August 24, 2011 11:47
diff --git a/commands/core/sitealias.drush.inc b/commands/core/sitealias.drush.inc
index 5352fd5..4f1ae22 100644
--- a/commands/core/sitealias.drush.inc
+++ b/commands/core/sitealias.drush.inc
@@ -39,6 +39,21 @@ function sitealias_drush_command() {
),
'topics' => array('docs-aliases'),
);
+ $items['site-set'] = array(
+ 'description' => '',
@nz
nz / Delete all documents in a Solr index using curl.md
Last active April 21, 2025 07:01
Delete all documents in a Solr index using curl
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl

curl "http://index.websolr.com/solr/a0b1c2d3/update?commit=true" -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

I'm amused at the traction this little gist is getting on Google! I would be remiss not to point out that six+ years later I'm still helping thousands of companies on a daily basis with their search index management, by providing managed Solr as a service over at Websolr, and hosted Elasticsearch at Bonsai. Check us out if you'd like an expert helping hand at Solr and Elasticsearch hosting, ops and support!