Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

gyurisc gyurisc

🏠
Working from home
Block or report user

Report or block gyurisc

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 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', () => console.info('✅ DOM is ready'));
// Emitted when the page is fully loaded
@somiandras
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
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
anonymous / simple_barcode_detection.py
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).
View simple_barcode_detection.py
# 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
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
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 http://www.pyimagesearch.com/2014/11/24/detecting-barcodes-images-python-opencv/
using System;
using System.Drawing;
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace LocateBarcode
@carolynvs
carolynvs / install-mono.sh
Last active Aug 20, 2019
Install Mono on Ubuntu
View install-mono.sh
wget http://download.mono-project.com/repo/xamarin.gpg
sudo apt-key add xamarin.gpg
echo "deb http://download.mono-project.com/repo/debian 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 https://go.microsoft.com
sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
sudo certmgr -ssl -m https://nuget.org
mozroots --import --sync
@mombrea
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
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);
}
@trey
trey / happy_git_on_osx.md
Last active Jan 24, 2020
Creating a Happy Git Environment on OS X
View happy_git_on_osx.md

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
You can’t perform that action at this time.