Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Developing

Mitxel Moriana bitumin

💻
Developing
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
<?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 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) {
$numberoffiles++;
}
View custom_breadcrumbs.php
// 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 Oct 30, 2018
Moodle pix icons
View index.html
<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 Dec 3, 2017 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon
View ultimate-ut-cheat-sheet.md

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 Jan 12, 2017 — forked from discordier/gist:ed4b9cba14652e7212f5
options for phpStorm @noinspection annotation
View gist:daabaa6d249662887d49b07cd9def9e3
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@bitumin
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
* (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