Skip to content

Instantly share code, notes, and snippets.

View niqdev's full-sized avatar

niqdev

  • Dublin
View GitHub Profile
@juzim
juzim / code.gs
Last active March 30, 2019 07:35
Google apps script for parsing the URL of the free ebook from the packtpub newsletter
function extractPacktpubUrl() {
try {
var ss = SpreadsheetApp.getActiveSheet();
var label = GmailApp.getUserLabelByName("packt_free_ebook");
var threads = label.getThreads();
if (threads[0] == undefined || threads[0].getMessages()[0] == undefined) {
Logger.log('No valid message found');
@ImanMousavi
ImanMousavi / remove_watermarks.py
Created October 15, 2016 08:24
Removes the annoying watermarks of it-ebooks.info's downloaded eBooks
#!/usr/bin/env python3
import sys
import re
import shutil
import argparse
import binascii
#
# WTF: This is a quick tool I've hacked together to easily remove the meta
@vizath
vizath / Responsive.js
Last active April 30, 2018 04:54
Create an object that you can listen on for screen sizes with incomplete Bootstrap example.
"use strict";
var EventEmitter = require('events').EventEmitter;
var CHANGE_EVENT = 'change';
var breakpoints = [0, 768, 992, 1200, Infinity];
var indexes;
var getSize = function() {
// http://stackoverflow.com/a/11744120/808657

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@calippo
calippo / Mappable.scala
Created July 27, 2016 21:51
Convert case class to map in shapeless
object Mappable {
implicit class ToMapOps[A](val a: A) extends AnyVal {
import shapeless._
import ops.record._
def toMap[L <: HList](implicit
gen: LabelledGeneric.Aux[A, L],
tmr: ToMap[L]
): Map[String, Any] = {
val m: Map[tmr.Key, tmr.Value] = tmr(gen.to(a))
@fideloper
fideloper / update_curl.sh
Last active January 11, 2024 15:23
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
@jturolla
jturolla / ActivityRealmRobolectricTest.java
Last active April 21, 2021 06:06
This gist provides a simple example of mocking a Realm database for android in java using Robolectric.
package com.example;
import android.content.Intent;
import android.widget.Button;
import com.example.MockSupport;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@rponte
rponte / get-latest-tag-on-git.sh
Last active May 16, 2024 06:48
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 31, 2024 07:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active June 1, 2024 09:44
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest