Skip to content

Instantly share code, notes, and snippets.

View suresh-kumara-gist's full-sized avatar

Suresh kumara suresh-kumara-gist

View GitHub Profile
import React from 'react';
import ReactDOM from 'react-dom';
class Contact extends React.Component {
constructor(props) {
super(props);
this.state = {
password: 'swordfish',
authorized: false
};
@suresh-kumara-gist
suresh-kumara-gist / log_notify-bck.sh
Created September 24, 2018 12:27
log_notify-bck.sh
#!/bin/bash -e
#flag = true; tail -n-1 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do if [ $flag ]; then echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier$
flag=true;
function trigger_notification(){
# if (( $flag == true )); then
echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -sound default;
tail -n100 /Applications/DevDesktop/apache/logs/error_log > /tmp/log.txt;
@suresh-kumara-gist
suresh-kumara-gist / log_notify-bck.sh
Created September 24, 2018 12:27
log_notify-bck.sh
#!/bin/bash -e
#flag = true; tail -n-1 -f /Applications/DevDesktop/apache/logs/error_log | while read line; do if [ $flag ]; then echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier$
flag=true;
function trigger_notification(){
# if (( $flag == true )); then
echo "$(tail -n3 /Applications/DevDesktop/apache/logs/error_log)" | terminal-notifier -sound default;
tail -n100 /Applications/DevDesktop/apache/logs/error_log > /tmp/log.txt;
https://www.cloudways.com/blog/best-startup-books-for-new-entrepreneurs/
var bookstitle; jQuery("h2").each(function(index) {
bookstitle += " @BooksBag " + $(this).text() + " by " + $( this).next("p").next("p").clone() //clone the element
.children() //select all the children
.remove() //remove all the children
.end().text(); console.log(bookstitle);
});
<?php
require_once customization_module_file_path();
/**
* @return string test.module file path
*/
function customization_module_file_path() {
// The directory of the file
$customizationsmodulepath = __DIR__;
/**
// get all ids of checkbox
var someObj={};
someObj.fruitsGranted=[];
someObj.fruitsDenied=[];
jQuery(“.js-rid-admin”).each(function() {
var $this = jQuery(this);
if($this.is("checked")){
someObj.fruitsGranted.push($this.attr("id"));
use Drupal\Core\Language\LanguageInterface;
echo strcmp("/", "/");
$test = \Drupal::service("pathauto.alias_cleaner")->cleanString("1");
$langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED;
$source = "";
$alias = $test;
$test = \Drupal::service("pathauto.alias_uniquifier")->uniquify($alias, $source, $langcode) ;
use Drupal\Core\Language\LanguageInterface;
echo strcmp("/", "/");
@suresh-kumara-gist
suresh-kumara-gist / Rendarable array to html string
Created April 24, 2018 02:20
Rendarable array to html string
$entity = EntityTest::create();
$entity->field_datasheet->target_id = $this->file->id();
$entity->save();
$output = $this->renderTestEntity($entity->id());
$expected_link = Link::fromTextAndUrl($this->field_label, Url::fromUri(file_create_url($this->file->getFileUri())));
$expected_link = $expected_link->toRenderable();
$expected_link['#attributes'] = [
'target' => '_blank',
];
$expected_link = \Drupal::service('renderer')->renderRoot($expected_link);
$menu = \Drupal::entityTypeManager()
->getStorage('menu_link_content')
->loadByProperties([
'menu_name' => ['agile-central-menu'],
'link.uri' => [ "entity:node/960"]
]);
If ($menu ) {
$menu->delete();
}
/**
* Implements hook_entity_type_alter()
* scheduled_update listing page is not providing content related information,
* we have added content related columns in scheduled update listing pages.
*/
//function customizations_entity_type_alter(array &$entity_types) {
// /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
// $entity_types['scheduled_update']->setListBuilderClass('Drupal\customizations\CustomScheduledUpdateListBuilder');
//}