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 | |
/** | |
* Calculate maximum nesting depth of parentheses. | |
* | |
* @see https://www.youtube.com/watch?v=zrOIQEN3Wkk | |
* @see https://leetcode.com/problems/maximum-nesting-depth-of-the-parentheses/ | |
*/ | |
$input = '(1+(2*3)+((8)/4))+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
<?php | |
/** | |
* Example enum usage. | |
* | |
* PHP8.1 will introduce the enum keyword, it will negate the need for the of | |
* validation code we often see below as enum will "make invalid states | |
* unrepresentable" | |
* | |
* @see https://wiki.php.net/rfc/enumerations |
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 | |
$variables['blog_post']['teaser_image'] = []; | |
$variables['blog_post']['thumb_image'] = []; | |
/** @var NodeInterface $node */ | |
if ($node->hasField('field_hero_image')) { | |
/** @var \Drupal\Core\TypedData\ListInterface $fieldHeroImage */ | |
$fieldHeroImage = $node->get('field_hero_image'); |
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
;;;; Demonstrate SBCL save-lisp-and-die. | |
;;; The characters of the Magic Roundabout are on the Magic Roundabout... on | |
;;; each execution of this program, the roundabout is *rotated* one place and | |
;;; the name of character at that place is printed. | |
;;; First load... | |
;;; sbcl | |
;;; * (load "magic.lisp") | |
;;; (magic) |
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
snippet bps | |
bps (${1:240}/120) | |
endsnippet | |
snippet d | |
d${1:1} $ $0 | |
endsnippet | |
snippet sound | |
sound "$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
<?php | |
/** | |
* The name of the taxonomy central database, usually from $databases | |
* configuration in settings.php | |
*/ | |
define('TAXONOMY_CENTRAL_DATABASE_NAME', 'vocabulary_server'); | |
/** | |
* Controller class for taxonomy central vocabularies. |
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
<!-- Captioned image --> | |
<figure class="image pull-right"><img alt="Hello" height="75" src="img/test-image.png" width="100" /> | |
<figcaption>Caption</figcaption> | |
</figure> | |
<!-- Un-captioned image --> | |
<img alt="Hello" class="pull-right" height="75" src="img/test-image.png" width="100" /> |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
int main (int argc, char *argv[]) { | |
FILE *f; | |
FILE *ret; | |
int c; |
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
diff --git a/php_stomp.c b/php_stomp.c | |
index 5e6f1e7..d9537b2 100755 | |
--- a/php_stomp.c | |
+++ b/php_stomp.c | |
@@ -32,9 +32,10 @@ | |
#include "ext/standard/php_smart_string.h" | |
#define FETCH_STOMP_OBJECT \ | |
- i_obj = (stomp_object_t *) zend_object_store_get_object(stomp_object TSRMLS_CC); \ | |
+ stomp_object_t *i_obj; \ |
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
#include <stdio.h> | |
char * cards [2] [2] = {"0000", "1000", "0111", "1111"}; | |
int main () | |
{ | |
printf("Address of cards is %p\n", &cards); | |
printf("Which can also be written %p\n", cards[0]); |
NewerOlder