Skip to content

Instantly share code, notes, and snippets.


Mitxel Moriana bitumin

View GitHub Profile
View area.hs
import System.Environment
import Data.List
-- takes first string element of given list of strings
first :: [String] -> String
first args
| null args = error "You must provide a radius"
| otherwise = head args
-- casts string to double
View add.php
// Should this data be added?
apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
// Do something before we add the data
do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
// Do Something after the data has been added
do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
bitumin / validation.php
Created Jun 11, 2019 — forked from marxjohnson/validation.php
Extract and validate zip file
View validation.php
$packer = new zip_packer();
if ($file) {
$itemid = $file->get_itemid();
$filepath = $file->get_filepath();
$filelist = $file->list_files($packer);
$numberoffiles = 0;
foreach ($filelist as $f) {
if (!$f->is_directory) {
View custom_breadcrumbs.php
// Ejemplo de construcción de custom breadcrumbds.
global $PAGE;
$b7string = get_string('B7', 'local_webbook');
$firstnode = $PAGE->navbar->add($b7string, $this->assignmentsurl, navigation_node::TYPE_SECTION);
if (($this->isteamview || $this->studentid > 0) && $this->canmanageactivity) {
$secondnode = $firstnode->add($this->activity->name, $this->parentactivityurl, navigation_node::NODETYPE_LEAF);
if ($this->modulename === 'forum') {
$thirdnode = $secondnode->add($this->currentteam['name'], null, navigation_node::NODETYPE_LEAF);
} else {
bitumin / index.html
Last active Oct 30, 2018
Moodle pix icons
View index.html
<div role="main" style=""><span id="maincontent" style=""></span><i class="icon fa fa-file-o fa-fw " aria-hidden="true" title="a/add_file" aria-label="a/add_file"></i>&nbsp;a/add_file<br><i class="icon fa fa-folder-o fa-fw " aria-hidden="true" title="a/create_folder" aria-label="a/create_folder"></i>&nbsp;a/create_folder<br>
<i class="icon fa fa-download fa-fw " aria-hidden="true" title="a/download_all" aria-label="a/download_all"></i>&nbsp;a/download_all<br><i class="icon fa fa-question-circle text-info fa-fw " aria-hidden="true" title="a/help" aria-label="a/help"></i>&nbsp;a/help<br>
class="icon fa fa-sign-out fa-fw " aria-hidden="true" title="a/logout" aria-label="a/logout"></i>&nbsp;a/logout<br>
<i class="icon fa fa-refresh fa-fw " aria-hidden="true" title="a/refresh" aria-label="a/refresh"></i>&nbsp;a/refresh<br><i class="icon fa fa-search fa-fw " aria-hidden="true" title="a/search" aria-label="a/search"></i>&nbsp;a/search<br><i class="icon fa fa-cog fa-fw "
bitumin /
Created Dec 3, 2017 — forked from yoavniran/
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies

bitumin / gist:daabaa6d249662887d49b07cd9def9e3
Created Jan 12, 2017 — forked from discordier/gist:ed4b9cba14652e7212f5
options for phpStorm @noinspection annotation
View gist:daabaa6d249662887d49b07cd9def9e3
bitumin / fetch_kindle.js
Created Aug 15, 2016 — forked from yangchenyun/fetch_kindle.js
Get back my books from Kindle
View fetch_kindle.js
* @fileoverview Program to free the content in kindle books as plain HTML.
* This is largely based on reverse engineering kindle cloud app
* ( to read book data from webSQL.
* Access to kindle library is required to download this book.
// The Kindle Compression Module copied from application