Skip to content

Instantly share code, notes, and snippets.

mostly busy, doing non-dev stuff

Alex Corvi alexcorvi

mostly busy, doing non-dev stuff
Block or report user

Report or block alexcorvi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View clients.xml
<occupation permenant="true">Dentist</occupation>
<occupation permenant="false">Salesman</occupation>
View style.css
/* paste this at the top: */
@import url('');
/* paste this at the bottom: */
.highlight {
background: #fff;
.highlighter-rouge .highlight {
alexcorvi / get-pi-using-gcd.js
Last active Mar 14, 2017
Calculate Pi Value from random numbers
View get-pi-using-gcd.js
function getPi(){
function getRand(maxRand){
return Math.floor(Math.random()*maxRand);
function gcd(a,b) {
if (!b) return a;
else return gcd(b,a%b);
let coPrimes = 0;
const iterations = 10000000;
View static-blog.ts
/// <reference path="../node_modules/@types/node/index.d.ts"/>
import * as fs from "fs";
import {join,resolve} from "path";
import marked = require("marked");
import handlebars = require("handlebars");
import mkdirp = require("mkdirp");
// retrieve a list of all the files in a given directory
function walkSync (dir:string, fileList?:string[]) {
const files = fs.readdirSync(dir).map((x)=>join(resolve(dir),x));
alexcorvi / style.css
Created Feb 28, 2017
vscode custom css
View style.css
.vs-dark .monaco-workbench {
--input-bgcolor: #3c3c3c;
background-color: red;
color: #e7e7e7;
alexcorvi / file.js
Created Feb 16, 2017
JSX without react
View file.js
var React = {
createElement: function (tag, attrs, children) {
var e = document.createElement(tag);
// Add attributes
for (var name in attrs) {
if (name && attrs.hasOwnProperty(name)) {
var v = attrs[name];
if (v === true) {
e.setAttribute(name, name);
alexcorvi / decode_if_b64.php
Last active Jun 29, 2016
will only decode the data if it's base64 (or a base64 data URI), if it's not will return the same data, also used to check if it's base64 or a data URI.
View decode_if_b64.php
function decode_if_b64($file_content="",$return_boolean=false) {
* Base64 files handling
* 1. first we'll check if it's a base64 data URI
* and we'll strip the data uri initials
* 2. Confirm it using regular expression
alexcorvi / mime2ext.php
Created Jun 29, 2016
converting mime types to extension in php
View mime2ext.php
function mime2ext($mime){
$all_mimes = '{"png":["image\/png","image\/x-png"],"bmp":["image\/bmp","image\/x-bmp","image\/x-bitmap","image\/x-xbitmap","image\/x-win-bitmap","image\/x-windows-bmp","image\/ms-bmp","image\/x-ms-bmp","application\/bmp","application\/x-bmp","application\/x-win-bitmap"],"gif":["image\/gif"],"jpeg":["image\/jpeg","image\/pjpeg"],"xspf":["application\/xspf+xml"],"vlc":["application\/videolan"],"wmv":["video\/x-ms-wmv","video\/x-ms-asf"],"au":["audio\/x-au"],"ac3":["audio\/ac3"],"flac":["audio\/x-flac"],"ogg":["audio\/ogg","video\/ogg","application\/ogg"],"kmz":["application\/"],"kml":["application\/"],"rtx":["text\/richtext"],"rtf":["text\/rtf"],"jar":["application\/java-archive","application\/x-java-application","application\/x-jar"],"zip":["application\/x-zip","application\/zip","application\/x-zip-compressed","application\/s-compressed","multipart\/x-zip"],"7zip":["application\/x-compressed"],"xml":["application\/xml","text\/xml"],"svg":
View file2URI-and-crop-with-croppie.js
* input file => data URI
* image => cropped image
(function($) {
View file2URI.js
$.file2URI = function (obj) {
if (obj.el.files && obj.el.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
else {
You can’t perform that action at this time.