Skip to content

Instantly share code, notes, and snippets.

View prasadshir's full-sized avatar

Prasa Shirgaonkar prasadshir

View GitHub Profile
@prasadshir
prasadshir / FirstController.php
Created April 16, 2020 15:59
FirstController.php
<?php
/**
* @file
* Contains \Drupal\mymodule\MyModuleController
*/
namespace Drupal\mymodule\Controller;
use Drupal\Core\Controller\ControllerBase;
@prasadshir
prasadshir / lotus.module
Last active May 9, 2020 12:01
D728: Task-06 Update nodes programatically
<?php
use Drupal\node\Entity\Node;
use Drupal\user\Entity\User;
/**
* Implements hook_ENTITY_TYPE_update().
* If a user has a Role named 'moderated',
* append the words 'MODERATED USER' to titles of
* all the nodes authored by the user
@prasadshir
prasadshir / HelloBlock.php
Created March 7, 2017 14:22
D728:Task-03: Create a custom block
<?php
/**
* Controller for the Block in the lotus module for D8.
* Add this file to src/Plugin/Block/ folder of the module
**/
namespace Drupal\lotus\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
@prasadshir
prasadshir / HelloController.php
Last active May 9, 2020 07:08
D728 Task-01: Create a custom page
<?php
/**
* Controller file for Lotus Drupal 8 module.
* Place this file in src/Controller folder inside the lotus module folder
**/
namespace Drupal\lotus\Controller;
use Drupal\Core\Controller\ControllerBase;
class HelloController extends ControllerBase {
@prasadshir
prasadshir / binding.js
Created September 20, 2013 10:46
Javascript Add Events Listener
window.onload = function(e){
document.getElementById("btn1").addEventListener('dblclick', myAlert);
var li = document.getElementsByTagName("li")
for (i=1;i<li.length; i++){
li[i].addEventListener('mouseover', function(e){
console.log('Hey, you were here!');
console.log(e);
});
}
@prasadshir
prasadshir / js-simple-todos-localaStorage.html
Created September 19, 2013 09:38
Simple To Dos App with Core JS & LocalStorate
<html>
<head>
<style>
div, section, footer, header{
padding:10px;border:1px solid green;
}
header, footer{text-align:center;}
.container {
padding:0;
max-width:960px; /*used for limiting the width*/
@prasadshir
prasadshir / JS-Object-Oriented.html
Created September 1, 2013 11:42
Object Oriented JS Simple Example
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>Object Oriented JS - Work with Console!</div>
<script>
@prasadshir
prasadshir / jQ-Simple-Todos.html
Created September 1, 2013 07:23
jQuery Simple ToDos List with Local Storage
<html>
<head>
<script src="js/jquery-1.9.1.js"></script>
<style>
div, section, footer, header{
padding:10px;border:1px solid green;
}
header, footer{text-align:center;}
.container {
padding:0;
@prasadshir
prasadshir / responsive.css
Created August 31, 2013 10:56
HTML5 Responsive Design
body {
margin: 20px;
padding: 0;
font-family: "Georgia", serif;
line-height: 150%;
}
h1 {
line-height: 100%;
}
@prasadshir
prasadshir / heros.json
Last active December 21, 2015 04:19
jQuery Ajax Basic Example
[
{
"id":0,
"name":"Amitabh Bacchan",
"type":"Bollywood",
"twitter":"SrBachchan",
"desc":"Amitabh is my most favorite hero"
},
{
"id":1,