$ tmux
CTRL+B C
-> create new pane
CTRL+B [num]
-> go to a pane
CTRL+D
-> finish bash session, closes the pane. Closing all panes will destroy the window and thus the tmux
<?php | |
/** | |
* A base class with getters and setters incorporated. | |
*/ | |
class ObjectBase { | |
/** | |
* Setter function for a generic attribute. | |
* | |
* @param string $property_name |
/* | |
* Description: Replaces in the string str all the occurrences of the source string old with the destination string new. The lengths of the strings old and new may differ. The string new may be of any length, but the string "old" must be of non-zero length - the penalty for providing an empty string for the "old" parameter is an infinite loop. In addition, none of the three parameters may be NULL. | |
* Returns: The post-replacement string, or NULL if memory for the new string could not be allocated. Does not modify the original string. The memory for the returned post-replacement string may be deallocated with the standard library function free() when it is no longer required. | |
* Dependencies: For this function to compile, you will need to also #include the following files: <string.h>, <stdlib.h> and <stddef.h>. | |
* Licence: Public domain. You may use this code in any way you see fit, optionally crediting its author (me, Laird Shaw, with assistance from comp.lang.c). | |
* http://creativeandcritical.net/str-repl |
<?php | |
$URL = 'http://example.com/login.php'; | |
$user = 'USER'; | |
$pass = 'PASS'; | |
$cookie_path = dirname(__FILE__).'/cookie.txt'; | |
/** | |
* Hace login en la web enviando un POST con el usuario y contraseña. |
<?php | |
/** | |
* Implements hook_menu(). | |
*/ | |
function MODULENAME_menu() { | |
$items['node/%node/edit-line-item/%commerce_line_item'] = array( | |
'title' => 'Edit line item in the cart', | |
'page callback' => 'node_page_view', | |
'page arguments' => array(1), |
<?php | |
// Create a new DateTime object with the first billing date. | |
$date = new DateTime('2019-01-31'); | |
// Add one month and display the wrong result. | |
$date->modify('+1 month'); | |
echo $date->format('Y-m-d'); |
<?php | |
// Create a new DateTime object with the first billing date. | |
$lastDate = new DateTime('2019-01-31'); | |
// Clone the date object or the original date will be altered. | |
$nextDate = clone $lastDate; | |
$periodUnit = 'M'; | |
// Add the number of months. |
#!/bin/bash | |
## Description: Import a fresh database from jenkins | |
## Usage: pull-db | |
## Go to https://jenkins.example.org/user/YOUR_USER/configure and add a new token | |
USER="JENKINS_USER" | |
TOKEN="JENKINS_TOKEN" | |
ARTIFACT="LAST_SUCCESSFUL_ARTIFACT_URL" | |
EXTRACT_PATH="" |
#!/bin/bash | |
## Description: Exclude ddev generated files from the project repo | |
## Usage: git-exclude | |
case $OSTYPE in | |
linux-gnu | "darwin"* ) | |
if [ $DDEV_PROJECT_TYPE == "drupal7" ]; then | |
grep -qxF ".ddev" .git/info/exclude || echo ".ddev" >> .git/info/exclude | |
grep -qxF "${DDEV_DOCROOT}/sites/default/.gitignore" .git/info/exclude || echo "${DDEV_DOCROOT}/sites/default/.gitignore" >> .git/info/exclude |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
var data | |
var formId = 'form' | |
function drawForm() { | |
if (!data) return | |
var outputEl = document.getElementById(formId); |