Skip to content

Instantly share code, notes, and snippets.

@miguelsaddress
miguelsaddress / how-to-gource.sh
Created October 9, 2015 08:35
Install Gource in Ubuntu (gource.io)
#Install Gource in Ubuntu
========================
#Go to the folder.... and
#see http://tylerfrankenstein.com/code/install-gource-ubuntu-1010-visualize-git-repo
sudo apt-get update
sudo apt-get install libsdl2-dev libsdl2-image-dev libpcre3-dev libfreetype6-dev libglew-dev libglm-dev libboost-filesystem-dev libpng12-dev libsdl1.2-dev libsdl-image1.2-dev libtinyxml-dev
./configure
make
sudo make install
@miguelsaddress
miguelsaddress / octave.md
Created January 6, 2016 20:25 — forked from obstschale/octave.md
An Octave introduction cheat sheet.

Octave CheatSheet

GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
(via GNU Octave)

Basics

  • not equal ~=
  • logical AND &&
@miguelsaddress
miguelsaddress / memInfo.scala
Last active October 26, 2020 16:13
Fetch info about the memory of you machine with Scala
import scala.language.postfixOps
import scala.util.{Success, Failure}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent._
import scala.util.Try
import sys.process._
import concurrent.Future
import concurrent.Promise
@miguelsaddress
miguelsaddress / Optionals.php
Last active June 15, 2019 15:18
A take on optionals in PHP
<?php
error_reporting(E_ALL ^ E_NOTICE);
abstract class Option {
protected $value;
public function __construct($value) {
if (isset($value)) return some($value);
else return none();
}
// actions/action_select_contact.js
function selectContact(contact) {
return {
type: 'CONTACT_SELECTED',
payload: contact
}
}
export default selectContact;
@miguelsaddress
miguelsaddress / actions-1.js
Created April 24, 2018 12:56
A Basic React + Redux introductory tutorial
// reducer_active_contact.js
export default function(state = null, action) {
switch (action.type) {
case 'CONTACT_SELECTED':
return action.payload
}
// i dont care about the action because it is not inside my
// list of actions I am interested int (case statements inside the switch)
return state
}
# code from: https://code.tutsplus.com/articles/what-is-genserver-and-why-should-you-care--cms-29143
defmodule MathServer do
def start do
spawn &listen/0
end
defp listen do
receive do
{:sqrt, caller, arg} -> send(caller, {:result, do_sqrt(arg)})
@miguelsaddress
miguelsaddress / Main.scala
Created May 26, 2017 09:10
Fetching Public User info from Github with Github4s
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.Await
import github4s.Github
import github4s.Github._
import github4s.GithubResponses.GHResult
import github4s.jvm.Implicits._
import akka.actor._
import scala.concurrent.Await
import scala.concurrent.duration._
object RebelAkktorsGist extends App {
/****************************
* Messages *
***************************/
@miguelsaddress
miguelsaddress / FizzBuzz.scala
Created March 6, 2016 14:24
Scala FizzBuzz implementation
import scala.util.Try
object FizzBuzz {
def main(args: Array[String]): Unit = {
val iterations = Try(args(0).toInt).getOrElse(0)
(1 to iterations).foreach {i =>
if (i % 15 == 0) println(s"$i - FizzBuzz")
else if (i % 3 == 0) println(s"$i - Fizz")
else if (i % 5 == 0) println(s"$i - Buzz")
else println(s"$i")