Skip to content

Instantly share code, notes, and snippets.

View rintoug's full-sized avatar

Rinto George rintoug

View GitHub Profile
@rintoug
rintoug / drupalTest.php
Created March 25, 2017 08:35
Custom sql query & display it in a table in drupal
<?php
$sql = 'SELECT name, email, mobile, place FROM {test}';
$header = array(
array('data' => 'name', 'field' => 'name'),
array('data' => 'email', 'field' => 'email'),
array('data' => 'mobile', 'field' => 'mobile'),
array('data' => 'place', 'field' => 'place'),
);
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50);
@rintoug
rintoug / jquery.js
Created March 25, 2017 09:02
Masking images with jQuery/css
//jQuery cod
(function($){
$(document).ready(function($){
$('.news img').each(function(){
var $this = $(this);
$this.css({
'background':'url(' + this.src + ') center center no-repeat'
})
.attr('src','/your/site/url/images/mask.png');
});
@rintoug
rintoug / googlemap.js
Created March 25, 2017 09:22
Google Maps API Examples – Google Maps JavaScript API
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&sensor=true"></script>
//Function
//Function to initialize the google map api
function initialize() {
var reqlat = '25.199971'; //Lattitude
var reqlong = '55.275371'; //Longittude
var mapOptions = {
center: new google.maps.LatLng(reqlat,reqlong),
@rintoug
rintoug / druapl-custom-module.php
Created March 25, 2017 10:09
Create custom content type from module – Drupal 7
<?php
/**
* hook_install()
* This will automatically called when a module is installed
*/
function newslettereasy_install() {
_install_node_type();
}
function _install_node_type() {
@rintoug
rintoug / facebook.html
Created March 25, 2017 10:46
Share with Facebook, Feed Dialog
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Feed Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
<p id='msg'></p>
@rintoug
rintoug / drupal.php
Created March 25, 2017 10:56
Check if user is logged in Drupal 7
<?php
global $user;
if ( $user->uid ) {
// Logged in user
}
else {
// Not logged in
}
?>
@rintoug
rintoug / grayscale.css
Created March 25, 2017 15:51
Cross-Browser Image Grayscale with CSS
.your_image {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: url(filters.svg#grayscale); /* Firefox 4+ */
filter: gray; /* IE 6-9 */
}
@rintoug
rintoug / grayscale.xml
Created March 25, 2017 15:52
Cross-Browser Image Grayscale with CSS
<svg xmlns="http://www.w3.org/2000/svg">
<filter id="grayscale">
<feColorMatrix type="matrix" values="0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0"/>
</filter>
</svg>
@rintoug
rintoug / googlemap.html
Created March 25, 2017 15:54
Google map with markers and popup
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height: 100%
}
body {
height: 100%;
@rintoug
rintoug / magento.xml
Created March 25, 2017 16:03
Changing the position of store switcher to header magento
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>