Skip to content

Instantly share code, notes, and snippets.

View longdog's full-sized avatar
🐶
Woof!

Denis longdog

🐶
Woof!
View GitHub Profile
@longdog
longdog / mobile-button.js
Created October 16, 2015 06:20
ios/android custom url schema support in your web page (viber example)
var $button = document.querySelector('.mobile-button'),
$input = document.querySelector('.message-input');
$button.addEventListener('click', function (e) {
e.preventDefault();
send_msg($input.value);
});
function send_msg(text) {
var app_url = "viber://forward?text=" + encodeURIComponent(text), /* custom schema url - app is launching, if it has been installed */
@longdog
longdog / mdk2.cs
Created October 16, 2015 06:29
МДК2 - 5-битная кодировка телеграфных аппаратов. Страшный секрет русского варианта этой кодировки мне удалось найти в древнем манускрипте “Стартстропный телеграфный аппарат СТА-М67″.
using System;
namespace Longdog.Encoding
{
///
/// MDK2 decoding
///
public class Mdk2
{
private static char[,] codepage = new char[3,32]{
{(char)1,'E',(char)10,'A',' ','S','I','U',(char)13,'D','R','J','N','F','C','K','T','Z','L','W','H','Y','P','Q','O','B','G',(char)2,'M','X','V',(char)0},
@longdog
longdog / ateq.md
Last active April 25, 2017 12:34
Ateq Protocol Reverse Engineering

A teq g520 serial port request/response reverse engineering

Get status

->

255 003 000 048 000 037 145 192

<-

@longdog
longdog / Nightly Fox Mini
Created October 11, 2016 09:51
Nightly Fox Mini theme
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Nightly Fox
* by NadirP
* http://nadirp.deviantart.com/
* v16.01.21
* Firefox 43.0.4
* Windows 10 */
/* SETINGS */
POST /api/v1/users - login/regisrer
GET /api/v1/users/123 - return user 123
PUT /api/v1/users/123 - update user 123 data
GET /api/v1/users?team=1 - return players of team 1
GET /api/v1/teams
GET /api/v1/teams/1
GET /api/v1/teams
@longdog
longdog / PasswordField.js
Last active August 11, 2021 08:31
React Bootstrap Password Control with show/hide effect
import React, { Component, PropTypes } from 'react';
import {FormControl} from 'react-bootstrap';
import styles from './PasswordField.less';
class PasswordField extends Component {
state = {
type: 'password'
};
{
"workbench.colorTheme": "Alabaster",
"editor.fontFamily": "Fira Code",
"editor.fontSize": 14,
"editor.fontLigatures": true,
"files.autoSave": "afterDelay",
"editor.minimap.enabled": false,
"css.validate": false,
"less.validate": false,
"scss.validate": false,
@longdog
longdog / hw1.sml
Last active June 30, 2021 11:55
Programming Languages, Part A, Week 2, hw1
(* 1 *)
fun is_older(d1: (int*int*int), d2: (int*int*int)) =
if (#1 d1) < (#1 d2)
then true
else if (#1 d1) > (#1 d2)
then false
else if (#2 d1) < (#2 d2)
then true
else if (#2 d1) > (#2 d2)
then false
fun same_string(s1 : string, s2 : string) =
s1 = s2
fun all_except_option(s:string, ss:string list) =
let fun acc(prevs, nexts) =
case nexts of
[] => NONE
| n'::nexts' => if same_string(s,n') then SOME(prevs @ nexts') else acc(n'::prevs, nexts')
in
acc([],ss)
exception NoAnswer
datatype pattern = Wildcard
| Variable of string
| UnitP
| ConstP of int
| TupleP of pattern list
| ConstructorP of string * pattern
datatype valu = Const of int