Skip to content

Instantly share code, notes, and snippets.

View rinatsafin's full-sized avatar

Rinat Safin rinatsafin

View GitHub Profile
@rinatsafin
rinatsafin / multiple_ssh_setting.md
Created October 4, 2020 13:44 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@rinatsafin
rinatsafin / Contract Killer 3.md
Created August 31, 2020 17:51
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@rinatsafin
rinatsafin / converts-webfont-to-base64.js
Created June 4, 2019 15:21 — forked from arielsalminen/converts-webfont-to-base64.js
Convert Google WOFF font to base64 format and inline to <head> of document
// Get binary file using XMLHttpRequest
function getBinary(file) {
var xhr = new XMLHttpRequest();
xhr.open("GET", file, false);
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.send(null);
return xhr.responseText;
}
// Base64 encode binary string
@rinatsafin
rinatsafin / cloudSettings
Last active November 29, 2018 13:15
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-11-29T13:15:35.863Z","extensionVersion":"v3.2.2"}
function h(type, props, ...children) {
props = props != null ? props : {};
return { type, props, children };
}
function render(vdom, parent = null) {
if (parent) parent.textContent = "";
const mount = parent ? (el => parent.appendChild(el)) : (el => el);
if (typeof vdom == "string" || typeof vdom == "number") {
return mount(document.createTextNode(vdom));
@rinatsafin
rinatsafin / handle_file_upload.php
Created September 27, 2016 16:43 — forked from ebidel/handle_file_upload.php
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
function promise(ex) {
var e = {}, r = {}
r.then = function (resolve, reject) {
e.resolve = resolve || function() {},
e.reject = reject || function() {}
}
ex(function() { e.resolve.apply(this, arguments) },
function() { e.reject.apply(this, arguments) })
return r
}
@rinatsafin
rinatsafin / demo gist
Created November 14, 2013 02:50
demo
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo