Skip to content

Instantly share code, notes, and snippets.

View gyurisc's full-sized avatar
🏠
Working from home

gyurisc gyurisc

🏠
Working from home
View GitHub Profile
@somiandras
somiandras / original.js
Last active November 7, 2016 17:27
Map and reduce instead of entangled 'for..each' and 'if...else' blocks.
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] = {
@brennanMKE
brennanMKE / .bash_profile
Last active June 20, 2018 23:12
Open in Visual Studio Code
# 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"'
@PaulStovell
PaulStovell / Bootstrapper.cs
Created May 9, 2013 10:03
The Octopus Nancy error handling strategy
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);
}
@madrobby
madrobby / everytimezone.coffee
Created April 17, 2011 13:36
First conversion of http://everytimezone.com/ JavaScript code to CoffeeScript
# Two things are important to note:
#
# 1) The code is fugly, because it was a JavaScript/iPad experiment.
# I know that it is ugly, so pretty please don't comment on that part.
# 2) I tried to use as many CoffeeScript features as possible,
# including but not limited to list comprehensions,
# heredocs, destructuring assignment and also the "do" operator
#
# I welcome comments about stuff that is not CoffeeScripty enough, or what I should
# write differently.
@carolynvs
carolynvs / install-mono.sh
Last active April 19, 2020 11:14
Install Mono on Ubuntu
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
anonymous
anonymous / simple_barcode_detection.py
Created November 4, 2015 09:42
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)
/* dragging logic for nomadlist.com/dating */
/* by @levelsio */
/* MIT license */
/* <dragging logic> */
$('body').on('mousedown touchstart','.card',function(e) {
if(!currentCardUserId) return;
if($('card.match_card').is(':visible')) return;
if(typeof e.originalEvent.touches !=='undefined') {
/* touch device */
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
@richardsawyer
richardsawyer / gist:62596e14d1ec4d148b28
Created April 25, 2015 04:16
Using openCvSharp to locate barcodes
// 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
@mlent
mlent / social-sharing-buttons.html
Last active February 24, 2023 08:22
Social sharing buttons
<ul>
<li>
<a href="https://twitter.com/share?text=TITLE OF YOUR POST via @YOUR_USERNAME&url=HTTPS://YOUR_WEBSITE.COM" onclick="window.open(this.href, 'twitter-share', 'width=550,height=235'); return false;">
Share on Twitter
</a>
</li>
<li>
<a href="https://news.ycombinator.com/submitlink?u=HTTP://YOUR_URL.COM&t=YOUR CONTENT" onclick="window.open(this.href, 'hn-share', 'width=550,height=350'); return false;">
Share on Hacker News
</a>