Skip to content

Instantly share code, notes, and snippets.

View bitumin's full-sized avatar
💻
Developing

Mitxel Moriana bitumin

💻
Developing
View GitHub Profile
@bitumin
bitumin / area.hs
Last active August 24, 2021 18:18
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
@bitumin
bitumin / add.php
Created July 8, 2019 08:34 — forked from igorbenic/add.php
How to Hook in WordPress Metadata | http://www.ibenic.com/hook-wordpress-metadata
<?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
bitumin / validation.php
Created June 11, 2019 07:17 — forked from marxjohnson/validation.php
Extract and validate zip file
$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) {
$numberoffiles++;
}
// Ejemplo de construcción de custom breadcrumbds.
global $PAGE;
$PAGE->navbar->ignore_active();
$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
bitumin / index.html
Last active October 30, 2018 14:48
Moodle pix icons
<html>
<body>
<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>
<i
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
bitumin / ultimate-ut-cheat-sheet.md
Created December 3, 2017 17:03 — forked from yoavniran/ultimate-ut-cheat-sheet.md
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
bitumin / gist:daabaa6d249662887d49b07cd9def9e3
Created January 12, 2017 00:36 — forked from discordier/gist:ed4b9cba14652e7212f5
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@bitumin
bitumin / fetch_kindle.js
Created August 15, 2016 17:59 — forked from yangchenyun/fetch_kindle.js
Get back my books from Kindle
/*
* @fileoverview Program to free the content in kindle books as plain HTML.
*
* This is largely based on reverse engineering kindle cloud app
* (https://read.amazon.com) to read book data from webSQL.
*
* Access to kindle library is required to download this book.
*/
// The Kindle Compression Module copied from http://read.amazon.com application