Skip to content

Instantly share code, notes, and snippets.

View AlexR1712's full-sized avatar
🏠
Working from home

Alexander J. Rodriguez D. AlexR1712

🏠
Working from home
View GitHub Profile
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@AlexR1712
AlexR1712 / bancos
Created December 27, 2017 20:17 — forked from xombra/bancos
Codigo y Bancos correspondientes de Venezuela
Banco:
<select name="banco">
<option value=""></option>
<option value="0156">100%BANCO</option>
<option value="0196">ABN AMRO BANK</option>
<option value="0172">BANCAMIGA BANCO MICROFINANCIERO, C.A.</option>
<option value="0171">BANCO ACTIVO BANCO COMERCIAL, C.A.</option>
<option value="0166">BANCO AGRICOLA</option>
<option value="0175">BANCO BICENTENARIO</option>
<option value="0128">BANCO CARONI, C.A. BANCO UNIVERSAL</option>
@lennonjesus
lennonjesus / .gitlab-ci.yml
Created December 7, 2017 16:06
Gitlab CI - Build Ionic 3 Project and generates apk files
# Gitlab CI - Build Ionic 3 Project and generates apk files
image: beevelop/ionic:latest
stages:
- deploy
cache:
untracked: true
key: "$CI_PROJECT_ID"
paths:
@peterbrinck
peterbrinck / Laravel on VestaCP.md
Last active July 2, 2023 14:49
Laravel web templates for VestaCP

I'm not using this or VestaCP anymore, so I can't confirm if still working or not.

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html

import { Injectable } from '@angular/core';
import { Http, Response, Headers } from '@angular/http';
import * as jwt_decode from 'jwt-decode';
export const TOKEN_NAME: string = 'jwt_token';
@Injectable()
export class AuthService {
private url: string = 'api/auth';
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi
@Underdoge
Underdoge / commonCharacterCount.js
Created February 25, 2017 23:26
commonCharacterCount
function commonCharacterCount(s1, s2) {
var string1=s1.split('');
var string2=s2.split('');
var common=0;
for(var i=0;i<string1.length;i++){
if(string2.indexOf(string1[i])>=0){
common++;
string2.splice(string2.indexOf(string1[i]),1);
}
@Kovah
Kovah / mysql-levenshtein.sql
Created February 22, 2017 21:29
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@barbietunnie
barbietunnie / udemy-courses-download-using-cookies.md
Last active April 7, 2024 22:24
Downloading Udemy videos with youtube-dl

How to download your Udemy course videos using youtube-dl

$ youtube-dl --list-extractors | grep udemy

Steps

  1. Get link to the course to download. e.g. https://www.udemy.com/course-name/
  2. Login into udemy website, save the cookie from chrome using Chrome (Cookie.txt)[1] export extension. Save it to file udemy-cookies.txt
  3. Get the link of the video that you want to download. usually in format. Use the command provided below where you have to replace the {course_link} and {path_to_cookies_file} with respective paths.
$ youtube-dl {course_link} --cookies {path_to_cookies_file}
@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100