Skip to content

Instantly share code, notes, and snippets.

View KhanMaytok's full-sized avatar
🎃
Comiendo chaufita

KhalO KhanMaytok

🎃
Comiendo chaufita
View GitHub Profile
is_processing = false;
last_page = false;
function addMoreElements() {
is_processing = true;
$.ajax({
type: "GET",
//FOS Routing
url: Routing.generate('route_name', {page: page}),
success: function(data) {
if (data.html.length > 0) {
denominations_USD = [
{ 'title': 'Hundred-dollar bill', 'count': 0, 'val': 10000 },
{ 'title': 'Fifty-dollar bill', 'count': 0, 'val': 5000 },
{ 'title': 'Ten-dollar bill', 'count': 0, 'val': 1000 },
{ 'title': 'Five-dollar bill', 'count': 0, 'val': 500 },
{ 'title': 'One-dollar bill', 'count': 0, 'val': 100 },
{ 'title': 'Quarter', 'count': 0, 'val': 25 },
{ 'title': 'Dime', 'count': 0, 'val': 10 },
{ 'title': 'Nickel', 'count': 0, 'val': 5 },
{ 'title': 'penny', 'count': 0, 'val': 1 }
@KhanMaytok
KhanMaytok / shortcode_wordpress.php
Created June 24, 2015 14:21
Add shortcode capanilities to text wodgrt
<?php
add_filter('widget_text', 'do_shortcode');
@KhanMaytok
KhanMaytok / functions.php
Created June 26, 2015 14:44
Get Editor capanilities to manage users
/*
* Let Editors manage users, and run this only once.
*/
function isa_editor_manage_users() {
if ( get_option( 'isa_add_cap_editor_once' ) != 'done' ) {
// let editor manage users
$edit_editor = get_role('editor'); // Get the user role
@KhanMaytok
KhanMaytok / javascript_resources.md
Last active August 29, 2015 14:23 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
for var in $(ps aux | grep ansible | awk '{print $2}'); do echo $var; sudo kill -9 $var; done
@KhanMaytok
KhanMaytok / Months.html
Last active August 29, 2015 14:24
Update Months events
<select name='monthSelect' id='monthSelect'>
<option value='all'>- Select a month -</option>
</select>
<select name='locationSelect' id='locationSelect'>
<option value='all'>- Select a location -</option>
</select>
<select name='categorySelect' id='categorySelect'>
<option value='all'>- Select a division -</option>
@KhanMaytok
KhanMaytok / functions.php
Created July 11, 2015 06:45
Searchable new fields events manager
<?php
...
// START EM Custm Attribute "Teacher" search
/* Create a new search attribute form entry for our new Event Attribute "teacher" (#_ATT{teacher})
The values are hard-coded but could probably be automatically selected
Add this field to the search form using an EM action.
nb. The action doc'd here http://wp-events-plugin.com/tutorials/adding-custom-event-search-form-fields/
does not seem to exist so use the footer one for inclusion in advanced search or the header one
for normal search. Read the source Luke.
*/
@KhanMaytok
KhanMaytok / functions.php
Created July 14, 2015 18:05
Add profile photo to wordpress menu
<?php
// Filter wp_nav_menu() to add profile link
add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
function my_nav_menu_profile_link($menu) {
$myavatar = bp_core_fetch_avatar( array(
'item_id' => bp_loggedin_user_id(),
'width' => 50,
'height' => 50,
'class' => 'avatar',
)