Skip to content

Instantly share code, notes, and snippets.

View KhanMaytok's full-sized avatar
🍛
Comiendo chaufita

KhalO KhanMaytok

🍛
Comiendo chaufita
View GitHub Profile
@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
@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 / shortcode_wordpress.php
Created June 24, 2015 14:21
Add shortcode capanilities to text wodgrt
<?php
add_filter('widget_text', 'do_shortcode');
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 }
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) {
@KhanMaytok
KhanMaytok / Doctrine anotattion generator
Created May 30, 2015 16:02
Generar Entidades doctrine
php bin/console doctrine:mapping:convert annotation ./src/AppBundle/Resources/config/doctrine/metadata/orm --from-database --force --filter="NombreDeTabla"
<h2>ASCII Animation Editor/Viewer</h2>
<table style="margin-left:auto;margin-right:auto">
<tr><td style="text-align:center">
Enter the frames below, separated by "<code>=====</code>".</td>
<td style="text-align:center">
<input type="button" value="Play the Animation" onclick="PlayAnimation();">
</tr>
<tr><td><textarea id="frameArea" rows=25 cols=55 style="font-size:8pt">
$(window).scroll(function(){
'use strict';
if ( $(window).scrollTop() > 49 ) {
$("#nav").addClass("nav-fixed");
} else {
$("#nav").removeClass("nav-fixed");
}
@KhanMaytok
KhanMaytok / mysql-backup
Created April 25, 2015 00:28
Backup Mysql
#!/bin/sh
now="$(date +'%d_%m_%Y_%H_%M_%S')"
filename="db_backup_$now".gz
backupfolder="/home/ubuntu/backups"
fullpathbackupfile="$backupfolder/$filename"
logfile="$backupfolder/"backup_log_"$(date +'%Y_%m')".txt
echo "mysqldump started at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
mysqldump --user=root --password=password --default-character-set=utf8 bd_vitekey_cloud | gzip > "$fullpathbackupfile"
echo "mysqldump finished at $(date +'%d-%m-%Y %H:%M:%S')" >> "$logfile"
echo "file permission changed" >> "$logfile"