Skip to content

Instantly share code, notes, and snippets.

@MarvinMiles
MarvinMiles / check_authorization.js
Created February 10, 2022 13:58
Telegram user authentication in JavaScript via Web Crypto API (dependency-free)
async function validate(data, bot_token) {
const encoder = new TextEncoder()
const checkString = await Object.keys(data)
.filter((key) => key !== "hash")
.map((key) => `${key}=${data[key]}`)
.sort()
.join("\n")
//console.log('computed string:', checkString)
<!doctype html>
<script>
// Docs: https://core.telegram.org/bots/api#getupdates
const UPDATES_URL = 'https://api.telegram.org/bot152495481:AAHOp1v7pz-cV3L2C-xiivqNi0qbVOOVNtQ/getUpdates';
// Bot name: @spbtv_test_bot
// sendMessage example:
// https://api.telegram.org/bot152495481:AAHOp1v7pz-cV3L2C-xiivqNi0qbVOOVNtQ/sendMessage?chat_id=2263761&text=blablbalba
</script>
@gokulkrishh
gokulkrishh / media-query.css
Last active July 28, 2024 17:25
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@just-boris
just-boris / index.js
Last active April 10, 2019 20:59
Gulp wrap pipe
/**
* Wrap gulp streams into fail-safe function for better error reporting
* Usage:
* gulp.task('less', wrapPipe(function(success, error) {
* return gulp.src('less/*.less')
* .pipe(less().on('error', error))
* .pipe(gulp.dest('app/css'));
* }));
*/
@staltz
staltz / introrx.md
Last active July 27, 2024 04:59
The introduction to Reactive Programming you've been missing
var gulp = require('gulp');
var browserify = require('browserify');
var notify = require('gulp-notify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var plumber = require('gulp-plumber');
var less = require('gulp-less');
var csso = require('gulp-csso');
var watch = require('gulp-watch');
var envify = require('envify');
@Sigmus
Sigmus / gulpfile.js
Last active November 15, 2017 11:55
gulpfile.js with browserify, reactify, watchify and gulp-notify.
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';