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 / particle-sphere.js
Created December 8, 2015 23:38
Create a sphere made of particles with Three.js
var distance = 100;
var geometry = new THREE.Geometry();
for (var i = 0; i < 1000; i++) {
var vertex = new THREE.Vector3();
var theta = THREE.Math.randFloatSpread(360);
var phi = THREE.Math.randFloatSpread(360);
@KhanMaytok
KhanMaytok / download-file.js
Last active November 28, 2015 00:06
Mostrar barra de descarga al descargar fichero node
var fs = require('fs');
var http = require('http');
var fsize;
var skBar = document.getElementById('progressbar');
//Función que maneja la descarga del archivo
var download = function(url, dest, cb) {
var file = fs.createWriteStream(dest);
var request = http.get(url, function(response) {
//Para ver el progreso, primero necesitamos saber el tamaño total del archivo
@KhanMaytok
KhanMaytok / nnnn
Last active September 27, 2015 09:18
https://www.digitalocean.com/community/tutorials/building-for-production-web-applications-overview
https://www.digitalocean.com/community/tags/load-balancing
http://www.microsiervos.com/archivo/peliculas-tv/asi-se-crearon-los-dragones-de-la-quinta-temporada-de-juego-de-tronos.html
https://aws.amazon.com/es/architecture/
@KhanMaytok
KhanMaytok / file.html
Created August 18, 2015 14:59
Populate a select with angular
<select ng-model="selectedTestAccount" ng-options="item.Id as item.Name for item in testAccounts">
<option value="">Select Account</option>
</select>
@KhanMaytok
KhanMaytok / ionic.html
Last active August 29, 2015 14:27
Absolute center in ionic
<ion-content padding="false" scroll="false" has-bouncing="false">
<div id="form">
<div class="list">
<label class="item item-input" id="company">
<input type="text" placeholder="Company Name*" focus-me="{{cmpFocus}}" ng-model="user.companyname" maxlength="100">
</label>
<div class="padding submitbtn">
<button type="submit" class="button" ng-click="registration(user);">SUBMIT</button>
</div>
</div>
@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',
)
@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 / 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>
for var in $(ps aux | grep ansible | awk '{print $2}'); do echo $var; sudo kill -9 $var; done
@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