Skip to content

Instantly share code, notes, and snippets.

Working from home

gyurisc gyurisc

Working from home
View GitHub Profile
stefanjudis /
Created Jan 15, 2020
API data in google sheets
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
View getting-to-know-puppeteer.example.js
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Emitted when the DOM is parsed and ready (without waiting for resources)
page.once('domcontentloaded', () =>'✅ DOM is ready'));
// Emitted when the page is fully loaded
somiandras / original.js
Last active Nov 7, 2016
Map and reduce instead of entangled 'for..each' and 'if...else' blocks.
View original.js
function extractData(messages) {
let data = {};
messages.forEach(message => {
if (message.symbols) {
let symbols = message.symbols;
symbols.forEach(symbol => {
if (data[symbol.symbol]) {
data[symbol.symbol].count += 1;
} else {
data[symbol.symbol] = {
amejiarosario / static_server.js
Created Aug 24, 2016
Node.js quick file server (static files over HTTP) using es6+
View static_server.js
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
anonymous /
Created Nov 4, 2015
Barcode detection from Adrian Rosebrock, updated to be compatible with OpenCV 3 (tested with OpenCV 3.0.0 and Python 2.7.9).
# This file was updated in order to support OpenCV v.3. (note lines 13, 14, 33, 43)
# import the necessary packages
import numpy as np
import cv2
def detect(image):
# convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
brennanMKE / .bash_profile
Last active Jun 20, 2018
Open in Visual Studio Code
View .bash_profile
# Add the alias below to ~/.bash_profile on a Mac
# Save the file and run: source ~/.bash_profile
alias code='open $@ -a "Visual Studio Code"'
richardsawyer / gist:62596e14d1ec4d148b28
Created Apr 25, 2015
Using openCvSharp to locate barcodes
View gist:62596e14d1ec4d148b28
// optimized to find a vertical barcode in an image
// inspired by
using System;
using System.Drawing;
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace LocateBarcode
carolynvs /
Last active Apr 19, 2020
Install Mono on Ubuntu
sudo apt-key add xamarin.gpg
echo "deb wheezy main" | sudo tee --append /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
sudo certmgr -ssl -m
sudo certmgr -ssl -m
sudo certmgr -ssl -m
mozroots --import --sync
mombrea / iOS-UploadImage.h
Created Jan 17, 2014
example of a multi-part form post in objective-c
View iOS-UploadImage.h
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"REST URL PATH"]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
[request setHTTPShouldHandleCookies:NO];
[request setTimeoutInterval:60];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"unique-consistent-string";
PaulStovell / Bootstrapper.cs
Created May 9, 2013
The Octopus Nancy error handling strategy
View Bootstrapper.cs
protected override void RequestStartup(ILifetimeScope requestContainer, IPipelines pipelines, NancyContext context)
pipelines.OnError.AddItemToEndOfPipeline((z, a) =>
log.Error("Unhandled error on request: " + context.Request.Url + " : " + a.Message, a);
return ErrorResponse.FromException(a);
base.RequestStartup(requestContainer, pipelines, context);
You can’t perform that action at this time.