Skip to content

Instantly share code, notes, and snippets.

View MaxGraey's full-sized avatar

Max Graey MaxGraey

View GitHub Profile
@MaxGraey
MaxGraey / copy-www-build-step.sh
Created July 7, 2015 16:55
Fixed XCode pre-build script for Cordova Projects
#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
@MaxGraey
MaxGraey / java-part.uno
Last active March 15, 2018 01:24
android UUID
private static extern(Android) string GetUUID()
@{
//android.app.Activity context = com.fuse.Activity.getRootActivity();
//return android.provider.Settings.Secure.getString(context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
final android.app.Activity context = com.fuse.Activity.getRootActivity();
final TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
final String deviceId = "" + tm.getDeviceId();
final String serialNum = "" + tm.getSimSerialNumber();
final String androidId = "" + android.provider.Settings.Secure.getString(
context.getContentResolver(),
@MaxGraey
MaxGraey / Electron_signing_node.js
Last active November 12, 2016 22:11
Electron signing in node.js
// 1. Generate new private RSA Key:
// openssl req -newkey rsa:2048 -new -nodes -keyout key.pem -out csr.pem
// 2. Derivate public RSA Key from private:
// openssl rsa -in key.pem -out public_key.pem -outform PEM -pubout
const crypto = require('crypto');
const fs = require('fs');
const hashes = crypto.getHashes();
@MaxGraey
MaxGraey / svg-vs-css-shadows.html
Created September 10, 2017 20:06
Example of SVG and CSS Shadows comparision
<!--
SVG Filters supports by all browsers:
http://caniuse.com/#search=SVG%20filters
Advantages:
- Performance (CSS) Filters usually has GPU acceleration
- Support transpatent areas
Disantages:
- Hasn't inset shadows and Spread Radius
@MaxGraey
MaxGraey / toolbar.cson
Created September 15, 2017 20:58
config for atom-flex-toolbar
[
{
type: "button"
icon: "social-buffer"
callback: "application:add-project-folder"
tooltip: "Add Project"
iconset: "ion"
style: {
color: "rgba(255, 255, 255, 0.7)"
transform: "scale(1.2)"
@MaxGraey
MaxGraey / gist:f6f72c75d05a2783b4ebb274e994df94
Created October 12, 2017 13:20
Mail clients html requierements
- https://www.campaignmonitor.com/css/
- https://kb.mailchimp.com/templates/code/common-html-mistakes
- http://litmus.com/email-testing
@MaxGraey
MaxGraey / uuid.js
Last active March 14, 2018 23:51
Fast RFC-compliant UUID v4 Generator
const charset = '0123456789abcdef'.split('');
const randomset = new Uint8Array(16);
export function uuid() {
let rand = 0;
for (let i = 0; i < 16; i++) {
if (rand < 2) {
rand += Math.random() * (1 << 24);
}
randomset[i] = rand & 0xFF;
export function defaultComparator<T>(a: T, b: T): i32 {
return (<i32>(a > b)) - (<i32>(a < b));
}
export function createDefaultComparator<T>(): (a: T, b: T) => i32 {
return (a: T, b: T): i32 => (<i32>(a > b)) - (<i32>(a < b));
}
export function isSorted<T>(data: Array<T>, comparator: (a: T, b: T) => i32 = createDefaultComparator<i32>()): bool {
for (let i: i32 = 1, len: i32 = data.length; i < len; i++) {
@MaxGraey
MaxGraey / lib.rs
Last active April 17, 2018 14:36
Shrink Rust wasm size
#![feature(core_intrinsics, lang_items)]
#![no_main]
#![no_std]
#[lang = "panic_fmt"]
extern "C" fn panic_fmt(_args: ::core::fmt::Arguments, _file: &'static str, _line: u32) -> ! {
use core::intrinsics;
unsafe {
intrinsics::abort();
}

Структура кода компонента

Последовательно, согласно нумерации.

\n - перенос строки

  1. import * as React from 'react'
  2. Импорты из сторонних библиотек\n
  3. Локальные импорты по абсолютным путям