Skip to content

Instantly share code, notes, and snippets.

Avatar
☠️
🏍

Andrea Franceschini Morpheu5

☠️
🏍
View GitHub Profile
View grammar-with-possibly-ambiguous-terminal-and-nonterminal.ne
@{%
const greekLetterMap = { "alpha": "α", "beta": "β", "gamma": "γ", "delta": "δ", "epsilon": "ε", "varepsilon": "ε", "zeta": "ζ", "eta": "η", "theta": "θ", "iota": "ι", "kappa": "κ", "lambda": "λ", "mu": "μ", "nu": "ν", "xi": "ξ", "omicron": "ο", "pi": "π", "rho": "ρ", "sigma": "σ", "tau": "τ", "upsilon": "υ", "phi": "ϕ", "chi": "χ", "psi": "ψ", "omega": "ω", "Gamma": "Γ", "Delta": "Δ", "Theta": "Θ", "Lambda": "Λ", "Xi": "Ξ", "Pi": "Π", "Sigma": "Σ", "Upsilon": "Υ", "Phi": "Φ", "Psi": "Ψ", "Omega": "Ω" }
const moo = require("moo");
const lexer = moo.compile({
Fn: ['cos', 'sin', 'tan',
'cosec', 'sec', 'cot',
'arccos', 'arcsin', 'arctan',
'arccosec', 'arcsec', 'arccot',
'cosh', 'sinh', 'tanh', 'cosech', 'sech', 'coth',
View LogRow.swift
struct Element: Decodable {
struct BinaryOperationProperties: Decodable
{ let operation: String }
struct BracketsProperties: Decodable
{ let type: String }
struct ChemicalElementProperties: Decodable
{ let element: String }
struct DifferentialProperties: Decodable
{ let letter: String }
struct FunctionProperties: Decodable
View actions.json
[
{
"event_type":"OPEN"
},
{
"event_type":"DRAG_POTENTIAL_SYMBOL",
"type":"Symbol",
"properties":{
"letter":"C"
}
View CalculatorScreen.kt
package net.morpheu5.bleedingscorecalculator
import android.content.SharedPreferences
import android.os.Bundle
import android.support.v4.app.FragmentActivity
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentTransaction
import android.support.v7.preference.PreferenceFragmentCompat
import android.support.v4.app.Fragment
import android.support.v7.preference.PreferenceManager
View test.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '>= 5.0.0'
@Morpheu5
Morpheu5 / .zshrc
Last active Nov 6, 2016
My ZSH RC
View .zshrc
### 2016-11-06 (porto)
export R_HOME='/opt/local/Library/Frameworks/R.framework/Resources'
path+=(/opt/local/bin /opt/local/lib/mariadb-10.0/bin ~/.rvm/bin ~/anaconda/bin ~/.bin ~/.cabal/bin)
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
source ~/.antigen/antigen.zsh
@Morpheu5
Morpheu5 / bft-test.cpp
Created Nov 25, 2015
A breadth-first tree traversal. #notetoself
View bft-test.cpp
#include <iostream>
#include <list>
using namespace std;
struct Node {
int value;
list<Node *> children;
};
View FBOTest.cpp
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Fbo.h"
#include "cinder/Perlin.h"
using namespace ci;
using namespace ci::app;
using namespace std;
#define IS_LANDSCAPE (getWindowWidth()/1.6f > getWindowHeight())
@Morpheu5
Morpheu5 / process_trello.rb
Last active Aug 29, 2015
A thing that grabs a Trello board export in JSON and turns it into a rather badly formatted Markdown document.
View process_trello.rb
#!/usr/bin/env ruby
require 'json_select'
require 'yajl'
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: #{$0} [options]"
opts.separator ''
@Morpheu5
Morpheu5 / Logger.h
Last active Dec 22, 2015
A ridiculously lightweight logging singleton class suitable for multi-threading applications. Just include it, initialize it, set the thread up, and you are good to go.
View Logger.h
/*
Copyright (c) 2013, Andrea Franceschini <andrea.franceschini@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,