Skip to content

Instantly share code, notes, and snippets.

Avatar
😋
Keep coding

Carlos Villavicencio po5i

😋
Keep coding
View GitHub Profile
@po5i
po5i / launch.json
Created Nov 28, 2018
Mocha run and debug tests
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Test All",
@po5i
po5i / gist:b7c1f7230277bdb4aa5ce68c66b37eed
Created Nov 11, 2018 — forked from burnash/gist:d6d35fbabd2566f2b1b9
Find strings with non-latin characters in files
View gist:b7c1f7230277bdb4aa5ce68c66b37eed
import sys
import os
import codecs
import unicodedata as ud
# from http://stackoverflow.com/questions/3094498/how-can-i-check-if-a-python-unicode-string-contains-non-western-letters
latin_letters = {}
View inline-svg-function.scss
// Replace letters
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@po5i
po5i / get_country_code_by_name.py
Created Sep 4, 2018
ISO 3166-1 Country code by name
View get_country_code_by_name.py
codes_dict = {
"Afghanistan": "AF",
"Albania": "AL",
"Algeria": "DZ",
"American Samoa": "AS",
"Andorra": "AD",
"Angola": "AO",
"Anguilla": "AI",
"Antarctica": "AQ",
"Antigua and Barbuda": "AG",
View keybase.md

Keybase proof

I hereby claim:

  • I am po5i on github.
  • I am po5i (https://keybase.io/po5i) on keybase.
  • I have a public key whose fingerprint is A6FA 5ABF B899 5755 B69F 14C8 C0C7 B4F6 2FA5 9180

To claim this, I am signing this object:

@po5i
po5i / targetted-delete.php
Last active Apr 9, 2018 — forked from caseysoftware/targetted-delete.php
This is a simple script using the Twilio PHP Helper library to retrieve Calls within a certain date range and the delete their associated recordings if they're particularly short.
View targetted-delete.php
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php';
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
$token = "your_auth_token";
$toNumber = "{fill this in with your number}";
@po5i
po5i / delete-recordings.curl
Last active Apr 9, 2018 — forked from caseysoftware/gist:1878920
This is a simple script using cURL to delete a single recording.
View delete-recordings.curl
curl -X DELETE 'https://api.twilio.com/2010-04-01/Accounts/ACxxxx/Recordings/RExxxx.json' \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
@po5i
po5i / delete-recordings.py
Last active Apr 9, 2018 — forked from caseysoftware/delete-recordings.py
This is a simple script using the Twilio Python module to retrieve Recordings within a certain date range and then delete them.
View delete-recordings.py
from datetime import date
from twilio.rest import Client
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
recordings = client.recordings.list(date_created_after=date(2012, 1, 1))
for recording in recordings:
@po5i
po5i / delete-recordings.php
Last active Apr 9, 2018 — forked from caseysoftware/delete-recordings.php
This is a simple script using the Twilio PHP Helper library to retrieve Recordings within a certain date range and then delete them.
View delete-recordings.php
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php';
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/console
$sid = "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
$token = "your_auth_token";
$twilio = new Client($sid, $token);
View convertImagesToBase64.js
function convertImagesToBase64 () {
contentDocument = tinymce.get('content').getDoc();
var regularImages = contentDocument.querySelectorAll("img");
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
[].forEach.call(regularImages, function (imgElement) {
// preparing canvas for drawing
ctx.clearRect(0, 0, canvas.width, canvas.height);
canvas.width = imgElement.width;
canvas.height = imgElement.height;
You can’t perform that action at this time.