Skip to content

Instantly share code, notes, and snippets.

View ahmadawais's full-sized avatar
Building the LLM computing primitive at Langbase.com

Ahmad Awais ⌘ ahmadawais

Building the LLM computing primitive at Langbase.com
View GitHub Profile
@mathetos
mathetos / smart-excerpts
Last active May 17, 2016 19:43
Smart Excerpts
<?php
/*
* This asks first for a Yoast SEO meta description,
* If that's not present, then it asks for the excerpt of the post,
* If that's not present, then it strips the content
* In this case, I have an excerpt length setting in the Customizer
* Both the excerpt and content stripping, also strip shortcodes
* @author Matt Cromwell <reachme@mattcromwell.com>
* @copyright Copyright (c) 2014, Matt Cromwell
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@justintadlock
justintadlock / fonts.php
Last active July 13, 2016 15:15
Enqueue fonts in WP
<?php
/**
* Functions for handling font enqueueing, registration, etc. This works with the
* Google Fonts API.
*
* Extending an idea from Jose Castaneda. This is a small script for loading Google fonts
* with an easy method for adding/removing/editing the fonts loaded via child theme.
*
* @link http://blog.josemcastaneda.com/2016/02/29/adding-removing-fonts-from-a-theme/
*/
@westonruter
westonruter / customize-readonly.js
Last active August 9, 2016 19:23
Customize Readonly WordPress Plugin: Only let superadmins make changes in the Customizer. All other admins can just preview changes. For them, the save UI is removed/disabled, and the Ajax request to save settings is blocked. The customize_readonly filter can be used to fine-tune which users are read-only.
/*global wp, jQuery */
wp.customize.ReadOnly = ( function ( $, api ) {
var self;
self = {};
self.init = function () {
// Hide the save button
$( '#save' ).hide();
@itzikbenh
itzikbenh / post.php
Last active October 18, 2016 04:48
Twitter share on text highlight. Inspired by theguardian.com. Tested on latest Chrome, Firefox, and Safari.
<!-- Add this anywhere in the page. It assumes your content is inside an <article> tag. -->
<a class="floating-twitter-share-link" href="#" title="Share this" target="_blank">
<i class="fa fa-twitter floating-twitter-share"></i>
</a>
<?php
/**
* The configuration options for the Shoestrap Customizer
*/
function shoestrap_customizer_config() {
$args = array(
@kevin-lee
kevin-lee / gitpullall
Last active January 12, 2017 17:08
Git pull from multiple remote git repositories
Copyright 2015 Lee, Seong Hyun (Kevin)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@benplum
benplum / matchMedia - IE8
Last active February 1, 2017 21:37
matchMedia Polyfill w/ Listeners - IE8
// Modernizr style test
if (!(window.webkitMatchMedia || window.mozMatchMedia || window.oMatchMedia || window.msMatchMedia || window.matchMedia)) {
var root = document.getElementsByTagName( 'html' )[0];
root.className += ' no-matchmedia';
}
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license - IE8 VERSION! */
window.matchMedia = window.matchMedia || (function(doc, undefined){
var docElem = doc.documentElement,
@Riveascore
Riveascore / gmail_display_none_workaround.html
Last active April 19, 2017 04:46
Currently trying to use inlined "display: none;" doesn't work for Gmail, so here's the best workaround (of about 3 different approaches I tried).
<!--
You can't do position absolute + visibility/opacity in gmail
display: none; only works if you inline it as !important, but then this destroys the functionality for
all other clients, this workaround has been working wonders for us!!!
-->
<style>
div.gmail {
display: block;
width: 0;
overflow: hidden;
class EDD_Paddle_Webhook_Handler extends EDD_Webhook_Handler {
function get_hook_id() {
return 'paddle';
}
function get_hook_name() {
return 'Paddle';
}
function get_endpoint_args() {
  • The benchmarks used by Marko, with one benchmark containing only a single component with ~50 lines of code, and the other 3 components with one of them fully static markup, are typical micro-benchmarks created to the advantage of certain implementation details. They are too isolated and too trivial to justify across-the-board performance claims.

  • For client-side performance I recommend using the 3rd party js-framework-benchmark as a more neutral reference; the benchmark tests a much bigger workload and covering a much more comprehensive performance scenarios. According to the data from the latest round Vue actually outperforms Marko. That said, even this benchmark doesn't reflect real world performance where much more overhead comes from big component trees.

  • Vue has significantly improved SSR performance for