Skip to content

Instantly share code, notes, and snippets.

View ajsb85's full-sized avatar
🖼️
Engaging cognitive processors...

Alexander Salas Bastidas ajsb85

🖼️
Engaging cognitive processors...
View GitHub Profile
function stripAccents(str) {
var reAccents = /[àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ]/g;
var replacements = 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY';
return str.replace(reAccents, function (match) {
return replacements[reAccents.source.indexOf(match)];
});
};
@ajsb85
ajsb85 / ibeacon.js
Last active August 29, 2015 14:21 — forked from janjongboom/ibeacon.js
navigator.mozBluetooth.defaultAdapter.startLeScan([]).then(handle => {
console.log('Start scanning', handle);
handle.ondevicefound = e=> {
var record = parseScanRecord(e.scanRecord);
if (record) {
console.log('Found an iBeacon', record.uuid, record.major, record.minor, e.rssi);
}
}
setTimeout(() => {
@ajsb85
ajsb85 / angular-1.3.15-fxos.js
Last active August 29, 2015 14:26 — forked from coolaj86/angular-1.3.15-fxos.js
AngularJS v1.3.15 for Firefox OS #fxos
This file has been truncated, but you can view the full file.
/**
* @license AngularJS v1.3.15
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {'use strict';
/**
* @description
*
@ajsb85
ajsb85 / gist:beaf35ce35cfdd8c7db5
Created March 3, 2016 16:59
source code for remote controls Síragon & Soneview
*Source code for the transmission of commands and protocols remote controls Síragon & Soneview
*TV models:
*Model 1: Soneview SV-421, SV-425
*Model 2: Síragon HLT24. Soneview LED2401, SV-425
*Model 3: Síragon 3203T, 3205C, 4202T, 4204C. Soneview SV-321
#include <16F876A.h>
#fuses NOWDT,XT,NOPROTECT
@ajsb85
ajsb85 / gist:acaacecad4da0deadae8
Created March 21, 2016 20:41 — forked from dustyf/gist:b6e72a7a7fd05de9598e
Example WordPress Simple JSON Endpoint Plugin
<?php
/**
* Plugin Name: WDS GIF API
* Plugin URI: http://webdevstudios.com
* Description: Adds a Custom Post Type to store GIFs and an API JSON Endpoint to access GIFs by a tag.
* Author: WebDevStudios
* Author URI: http://webdevstudios.com
* Version: 1.0.0
* License: GPLv2
*/
@ajsb85
ajsb85 / ssh-telegram.sh
Created May 29, 2016 14:19 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@ajsb85
ajsb85 / 0_reuse_code.js
Created September 6, 2016 10:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ajsb85
ajsb85 / readme.md
Last active December 14, 2016 11:50 — forked from max-mapper/readme.md
IRC OP protips

IRC OP PROTIPS

FLAGS #flyve-mdm ajsb85 +*

check if the nick of the user is registered with /msg nickserv info <name>

if it is registered, you can use: /msg chanserv akick #channelname add <name> and then chanserv will automagically add the IP bans when they join

@ajsb85
ajsb85 / gist:f64ac373431009d59dce1fb083beeaa0
Created December 15, 2016 10:41 — forked from alimd/gist:3344523
All github Emoji (Smiles)

All github Emoji (Smiles)

ali.md/emoji

:bowtie: | 😄 | 😆 | 😊 | 😃 | ☺️ | 😏 | 😍 | 😘 | :kissing_face: | 😳 | 😌 | 😆 | 😁 | 😉 | :wink2: | 👅 | 😒 | 😅 | 😓

😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | :neckbeard: | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷

😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨

@ajsb85
ajsb85 / integration.async.await.js
Created January 23, 2017 13:33 — forked from jcready/integration.async.await.js
Node.js example of GitHub Integration auth process
// With async/await support
const fs = require('fs')
const jwt = require('jwt-simple')
const pem_file = '/path/to/github.pem' // the absolute path to your Application Pem Certificate issued by GitHub
const integration_id = 0 // GitHub Application Integration ID
const installation_id = 0 // once installed on an organization. The Organization Integration ID
const expire_seconds = 60 // number of seconds the jwt token expires (max ~600 but not designated by GitHub)
const slug = 'owner/repo' // name of repo for demo purposes
const privateKey = fs.readFileSync(pem_file)