Skip to content

Instantly share code, notes, and snippets.

View tinyamasisurum0's full-sized avatar

ERCAN MURAT KISACA tinyamasisurum0

View GitHub Profile
@toanshulverma
toanshulverma / DataDisplayController.cls
Last active November 20, 2023 22:05
Sample Code to Generate PDF from Lightning components with in-memory data
public class DataDisplayController {
public String PDFData {get; set;}
public DataDisplayController(){
PDFData = '';
}
public PageReference downloadPDF(){
System.PageReference pageRef = new System.PageReference('/apex/PDFGenerator');
@andrewlimaza
andrewlimaza / example.html
Created December 19, 2016 11:31
Print certain div / elements using window.print()
<script>
function printDiv(divName){
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
@codehooligans
codehooligans / WC_checkout_field_validation
Last active August 20, 2022 07:47
WooCommerce Checkout form DOB date field validation in jQuery
// We are using the WooCommerce Checkout Field Editor plugin in addition to WooCommerce. The Checkout Field Editor
// does a nice job at providing a UI for manage additional fields. But doesn't provide any method to do validations.
// So this code helps with that on a very specific implemention where we have a Gender select and a DoB date selector.
// On the Gender we want to ensure the selected value is 'Male' or 'Female' only. We don't want the
default option 'Choose Option' to be valid. On the DoB we want to enforce the user is 18 or older.
add_action( 'woocommerce_after_checkout_validation', 'woo_checkout_additional_field_validation' );
function woo_checkout_additional_field_validation() {
if (!defined('WOOCOMMERCE_CHECKOUT')) {
return;
@SeanTOSCD
SeanTOSCD / fes-dashboard-tabs.php
Last active November 2, 2015 18:50
Custom FES Dashboard Tabs
<?php // DON'T COPY THIS LINE
if ( class_exists( 'EDD_Front_End_Submissions' ) ) {
function custom_vendor_dashboard_menu() {
$menu_items = array();
// Dashboard tab
$menu_items['home'] = array(
"icon" => "home",
"task" => array( 'dashboard', '' ),
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");