Skip to content

Instantly share code, notes, and snippets.

View vinaygopinath's full-sized avatar

Vinay Gopinath vinaygopinath

View GitHub Profile
@vinaygopinath
vinaygopinath / app.component.ts
Created July 19, 2016 14:25
Simple Angular2 Select component (with dropdown) - http://plnkr.co/edit/7ErSkd?p=preview
import { Component } from '@angular/core';
import { SelectComponent } from './select.component';
@Component({
selector: 'my-app',
template: `
<h1>Select component demo</h1>
<custom-select placeholder-text="Select a country" [items]="countries" (onItemSelected)="setCountrySelection($event, 1)"></custom-select>
<h3 *ngIf="selectedCountry">You selected <strong>{{selectedCountry}}</strong></h3>
`,
@vinaygopinath
vinaygopinath / place-autocomplete.css
Last active August 15, 2018 06:11
Google maps location/place suggestions with Angular material autocomplete (md-autocomplete) https://plnkr.co/edit/dITwTF?p=preview
/*
Optional adjustments for md-autocomplete in mobile screens
*/
#place-autocomplete > md-autocomplete md-input-container {
margin-top: -10px;
}
/*Media query for tablets and above */
@vinaygopinath
vinaygopinath / index.html
Last active July 5, 2018 02:19
Custom Angular search filter that matches the search query against a combination of multiple properties
<!DOCTYPE html>
<html ng-app="CustomSearchDemo">
<!-- Plunker: http://plnkr.co/edit/8qagvK -->
<head>
<link rel="stylesheet" href="style.css"/>
</head>
<body ng-controller="DemoCtrl">
<div>
@vinaygopinath
vinaygopinath / NREGA "Delay in payment" script
Created September 24, 2014 14:18
This script automatically selects various fields in the "Delay in Payment" section of the Mahatma Gandhi National Rural Employment Guarantee Act ( MGNREGA) website
/**
* This script does the following on the "Delay in Payment" section of NREGA
* "Approved" = No
* "Disapproval reason" = "Funds not available at the paying authority level"
* "Select" = check
*
* Usage: When the website (http://164.100.129.3/netnrega/payorder_delayPayment.aspx) is open, press
* Ctrl + Shift + K in Firefox and Ctrl + Shift + J in Chrome, select Console (if it isn't already selected)
* and paste the code into the console. Some values may need modification depending on your internet connection
*
@vinaygopinath
vinaygopinath / minimum_cart_count.php
Created February 16, 2014 18:59
A small tweak for the WooCommerce plugin for WordPress - This sets the minimum number of items to be present in the cart for checkout. Here's the error message in action: http://imgur.com/74BEhW5
/*
* Include this code in your theme's functions.php
*/
add_action( 'woocommerce_checkout_process', 'wc_minimum_cart_count' );
function wc_minimum_cart_count() {
global $woocommerce;
$minimum = 6;
if ( $woocommerce->cart->get_cart_contents_count() < $minimum ) {