Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙
Being awesome

Rob Janssen RobThree

🤙
Being awesome
View GitHub Profile
View 1-WeightedObjectPickerExample.cs
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
// Demo
static void Main(string[] args)
{
// Define some weighted object (in this case: strings, but could be anything (e.g. "Customer") and set their weights
@RobThree
RobThree / temps.py
Last active May 30, 2016
Python script that runs a webservice that returns readings from DS18B20 temperature sensors connected to a Raspberry Pi as JSON data for al sensors or a specific sensor
View temps.py
#!/usr/bin/env python
# You will need to have web.py installed. To install, run: pip install web.py
# How to install as service: http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/
# Should the above page be offline; a mirror is at: http://archive.is/20160529210455/http://blog.scphillips.com/posts/2013/07/getting-a-python-script-to-run-in-the-background-as-a-service-on-boot/
# You can run this as:
# python temps.py
# This will run the service on port 8080; # Optionally, you can specify a port:
@RobThree
RobThree / gitlab-checkandnotify
Last active Jun 3, 2016
gitlab version checker & notifier
View gitlab-checkandnotify
#!/bin/bash
#mail recipient
RCPT=someone@gmail.com
#args: $rcpt $subject $text
sendnotification() {
echo -e "$3" | mail -s "$2" -t $1
}
echo -n "Checking version: "
View keybase.md

Keybase proof

I hereby claim:

  • I am RobThree on github.
  • I am robiii (https://keybase.io/robiii) on keybase.
  • I have a public key whose fingerprint is 8FCA 6E28 8E13 F77A 628D BADA B3F7 16D6 6A0A A857

To claim this, I am signing this object:

@RobThree
RobThree / ObjectMerger.php
Created May 21, 2015
Class used to merge objects based on a specific syntax specified as strings
View ObjectMerger.php
<?php
/**
* Dynamically merges objects; it allows for string-values to be 'expanded' into actual object values following a simple
* syntax: $objectname.property or $objectname.property.property.property[foo] or $objectname[1]
*
* Example:
*
* $source = array('customer' => $customerobject, 'order' => $orderobject);
* $dest = json_decode('{ "myreference": "abc-123", "customer_id": "{$customer.id}", "order_id": "{$order.id}" }');
*
View WordTableExtractor.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml;
//Usage:
// var tables = new WordTableExtractor().ExtractTables(@"path\to\my\file.docx");
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View duplicatefinder.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Program
{
static void Main(string[] args)
{
var duplicates = new DirectoryInfo(@"G:\sampling")
@RobThree
RobThree / ratelimiter.php
Last active Dec 16, 2019
Simple, rude, rate limiter (using memcache).
View ratelimiter.php
<?php
/* Very simple, crude, rate limiter */
/*
Assumes _MEMCACHEDSITEPREFIX, _MEMCACHEDHOST and _MEMCACHEDPORT are `defined`:
define('_MEMCACHEDHOST', '127.0.0.1');
define('_MEMCACHEDPORT', 11211);
define('_MEMCACHEDSITEPREFIX', 'mysite');
*/
@RobThree
RobThree / exampleclassesandinterfaces.cs
Created Nov 1, 2013
An improvement upon http://stackoverflow.com/a/4100126/215042. This factory can be used as a generic factory. Improvements are, amongst others: • Generics • Being able to specify case(in)senstivity when resolving instances • Constructor overloads; the default will assume the Executing Assembly, other assemblies can be passed using an overload of…
View exampleclassesandinterfaces.cs
public interface IFood
{
bool IsTasty { get; }
}
public class Hamburger : IFood
{
public bool IsTasty { get { return true; } }
}
You can’t perform that action at this time.