Skip to content

Instantly share code, notes, and snippets.

View embarq's full-sized avatar
🕶️
Working hard

Li Ihor embarq

🕶️
Working hard
View GitHub Profile
$background: #f9f9f9;
$button-background: #d3d8dd;
$footer-background: #373d44;
$main-color: #04bf9d;
$about-us-icon-background: #373d44;
$text-color: #bbbaba;
$list-first-color: #bbbaba;
$list-second-color: #fafafa;
/// Move to "_reset.scss"
@embarq
embarq / Program.cs
Created August 11, 2016 23:20
Simple task-based async code descripting
using System;
using System.Threading;
using System.Threading.Tasks;
namespace Async
{
class Program
{
static void Main(string[] args)
{
@embarq
embarq / ControlInvokeRequired.cs
Last active August 12, 2016 00:23
Helper method to determin if invoke required
/// <summary>
/// Helper method to determin if invoke required, if so will rerun method on correct thread.
/// if not do nothing.
/// </summary>
/// <param name="c">Control that might require invoking</param>
/// <param name="a">action to preform on control thread if so.</param>
/// <returns>true if invoke required</returns>
public bool ControlInvokeRequired(Control c, System.Action a)
{
if (c.InvokeRequired)
@embarq
embarq / remmer.js
Last active August 17, 2016 22:49
Converts rem to px units in each *.scss file in "src" dir
"use strict";
var fs = require('fs');
var src = 'stylesheets/';
var dist = 'dist';
var walk = (dir, callback) => {
var results = [];
fs.readdir(dir, (err, list) => {
if (err) {
@embarq
embarq / huge.json
Created August 19, 2016 01:54
17mb of mock data
This file has been truncated, but you can view the full file.
[
{
"Email": "Eric.Torp@deanna.us",
"Full Name": "Sadye Lemke",
"Country": "Japan",
"User Id": 0,
"Created At": "1993-06-25T17:22:34.026Z"
},
{
"Email": "Jarrett@sonny.me",
@embarq
embarq / fabric-pattern.cpp
Last active September 8, 2016 16:42
http:// cpp.sh/4jcf
#include <iostream>
#include <vector>
class Cattle {
public:
virtual void info() {};
virtual ~Cattle() {};
};
class Cow : public Cattle {
@embarq
embarq / reflow.cpp
Last active September 20, 2016 08:00
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
struct Pair {
double a;
double b;
};
"use strict";
let getErrorRank = err => {
let rankCounter = 0;
let ranks = new Array(8).fill().map((item, i) => 1 / Math.pow(10, i)).slice(1);
for (let i = 0; i < ranks.length; i++) {
if (err < ranks[i]) {
rankCounter++;
} else {
@embarq
embarq / handleFormResponse.js
Created October 7, 2016 08:45
Google AppsScript macro for Google Forms and Google Sheets. Script should be installed by running "Initialize" function. Sorts form's response data by user gender. Append data after last row that contains any data(Prevent unnecessary whitespace between rows)
function isSheetExist(sheetName) {
return SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName) != null;
}
function formResponseFilter(e) {
if (!e) throw new Error("Please go the Run menu and choose Initialize");
try {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var base = ss.getSheets()[0];
var sheet = null;