Skip to content

Instantly share code, notes, and snippets.

View davidjguru's full-sized avatar
🍅
Working within a pomodoro cycle

David Rodriguez davidjguru

🍅
Working within a pomodoro cycle
View GitHub Profile
@gueno
gueno / Drupal Multisite Drush Script
Created February 4, 2012 14:08
If you're running multiple sites on one drupal installation, here is a script to run different Drush commands on all of them
#!/bin/bash
# Get all Drupal sites
sites=`find . -maxdepth 1 -type d -print | grep -v '/all$' | grep -v '/default$' | grep -v '\.$'`
echo "Choose the commande to execute : "
echo "1. update"
echo "2. put sites offline"
echo "3. put sites online"
echo "4. clear all cache"
@markSci5
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@rajeshpv
rajeshpv / gist:6356679
Last active May 25, 2020 18:14
Install Balsamiq for ubuntu
helpfull links
(1) https://gist.github.com/cbednarski/5379830
(2) http://www.clarifylinux.org/2012/04/ubuntu-1204-tweak-and-hack-round-up.html
(3) http://jeffhendricks.net/?p=68
(4) BEST for 64 bit http://www.randomhacks.co.uk/how-to-install-balsamiq-mockups-on-ubuntu-13-10/
The steps I did
RUN>>
locate libgnome-keyring.so /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@patkujawa-wf
patkujawa-wf / git diff patch between branches.md
Created April 3, 2014 18:36
If you want to get the difference between two branches as a diff patch

If you want to get the difference between two branches, say master and branch-name, use the following command: git diff master..branch-name

If you want that same diff in a patch, because patches are handy, just add the output redirect: git diff master..branch-name > branch-name.patch

If you need to import that patch into something like Crucible then you'll need to get rid of the a and b prefixes that git adds: git diff --no-prefix master..branch-name > branch-name.patch

@facelordgists
facelordgists / delete-git-recursively.sh
Created May 13, 2015 05:28
Recursively remove .git folders
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
@facine
facine / __INDEX.txt
Last active August 6, 2023 15:33
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@Jaesin
Jaesin / delete_content_entities.d8.php
Created June 22, 2015 07:14
Delete all content entities in Drupal 8.
<?php
// Delete all nodes.
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute());
// Delete all files.
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute());
// Delete all taxonomy terms.
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute());
@illepic
illepic / file_rel_path_d8.php
Last active August 23, 2023 09:40
Get relative path for fid in Drupal 8
<?php
use Drupal\file\Entity\File;
// public://images/blah.jpg
$drupal_file_uri = File::load($fid)->getFileUri();
// /sites/default/files/images/blah.jpg
$image_path = file_url_transform_relative(file_create_url($drupal_file_uri));
@crittermike
crittermike / IntegerDropdownWidget.php
Created October 17, 2016 20:14
Drupal 8 form widget example: creates a select dropdown for integer fields. Place in src/Plugin/Field/FieldWidget
<?php
/**
* @file
* Defines a dropdown widget for integer fields.
*/
namespace Drupal\nba_content_core\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldFilteredMarkup;
use Drupal\Core\Field\FieldItemListInterface;