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
@ahmadawais
ahmadawais / functions.php
Last active August 29, 2015 14:08
WordPress Login Redirect
/** Login Redirect
* Redirect user after successful login.
*
* @param string $redirect_to URL to redirect to.
* @param string $request URL the user is coming from.
* @param object $user Logged user's data.
* @return string
*/
function my_login_redirect( $redirect_to, $request, $user ) {
//is there a user to check?
@ahmadawais
ahmadawais / functions.php
Created October 30, 2014 17:09
Custom Login/Logout handling for using WordPress as a CMS
/*Login Error Handle*/
add_action( 'wp_login_failed', 'aa_login_failed' ); // hook failed login
function aa_login_failed( $user ) {
// check what page the login attempt is coming from
$referrer = $_SERVER['HTTP_REFERER'];
// check that were not on the default login page
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') && $user!=null ) {
// make sure we don't already have a failed login attempt
@ahmadawais
ahmadawais / Particles.js-based-Hero-Unit.markdown
Last active August 29, 2015 14:10
ParticlesJS based Hero Unit

Particles.js based Hero Unit

Using particle to build an animated hero unit for an upcoming product.

A Pen by Ahmad Awais on CodePen.

License.

@ahmadawais
ahmadawais / Basic-CSS-Hacks.markdown
Created November 28, 2014 11:16
Basic CSS Hacks
@ahmadawais
ahmadawais / _variables.scss
Last active August 29, 2015 14:11
Partial SCSS colors variables
/* ----------------------------------------------------------------------------
* Color variables
*
* @pacakge PP
* since 1.2.1
*
* $wh variants 20% on hover , 50% footer
* $bl variants 20% on text and footer bg, 50% on small footer bg
*
<div class="form-horizontal">
<div class="form-group"><label class="control-label col-md-3">Full Name</label><div class="col-md-9">[text* your-name class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Email Address</label><div class="col-md-9">[email* your-email class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Subject</label><div class="col-md-9">[text your-subject class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Message</label><div class="col-md-9">[textarea your-message x5 class:form-control]</div></div>
<div class="form-group"><div class="col-md-offset-3 col-md-9">[submit class:btn class:btn-primary "Send"]</div></div>
</div>
@ahmadawais
ahmadawais / _header.scss
Created January 1, 2015 08:56
WP Menu Design
/* ----------------------------------------------------------------------------
* aa_nav
*
* Tabs object.
*
* 1. Tables (kinda) for layout!
* 2. This is the magic bit; make all children occupy equal width.
* 3. Required to make the tabs fill their container.
* 4. Make each tab pack up horizontally.
@ahmadawais
ahmadawais / gist:9f45a91e43b36127ac9b
Created January 5, 2015 13:38
Check the path of SVN
which svn
@ahmadawais
ahmadawais / plugin.php
Created January 22, 2015 11:06
Quit if plugin file is called directly.
// If this file is called directly, abort.
if(!defined('WPINC')){die;}