Skip to content

Instantly share code, notes, and snippets.

Misbahul D Munir mdmunir

Block or report user

Report or block mdmunir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mdmunir
mdmunir / php-html-css-js-minifier.php
Created May 29, 2019 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
View php-html-css-js-minifier.php
<?php
// Based on <https://github.com/mecha-cms/extend.minify>
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\'|`(?:[^`\\\]|\\\.)*`');
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/');
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>');
define('MINIFY_COMMENT_JS', '//[^\n]*');
define('MINIFY_PATTERN_JS', '/[^\n]+?/[gimuy]*');
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>');
View AlmanakController.php
<?php
namespace console\controllers;
/**
* Description of AlmanakController
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
View custom_delay.ino
void setup(void){
}
long t1=0,t2=0;
void loop(void){
if(t1 < millis()){
// kode di sini yang mau di delay
t1 = millis() + 3000; // delay tiap 3 detik
}
View arduinolog.c
/*
SD card read/write
This example shows how to read and write data to and from an SD card file
The circuit:
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)
View prependRow.js
function prependRow($e) {
var settings = $e.data('mdmTabularInput').settings;
var counter = settings.counter++;
var template = replace(settings.template, settings.replaces, counter);
var $row = $(template);
var $element = settings.container ? $e.find(settings.container) : $e;
var event = $.Event('beforeAdd');
$e.trigger(event, [$row]);
if (event.result !== false) {
@mdmunir
mdmunir / meeus.js
Created Nov 10, 2017
meeus algorithm
View meeus.js
This file has been truncated, but you can view the full file.
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
View tds.ino
#define TDS_SOURCE_1 2
#define TDS_SOURCE_2 3
float getTds() {
// konstanta diperoleh dari percobaan. Hasil dari fungsi ini dibandingkan dengan tds meter standar. Hasilnya diregresikan
// Baca README.md
float C1 = 27.0, C2 = 61.4; // <- dari regresi linier, mungkin berbeda tergantung nilai R yg dipakai. R=1K8 ohm
float x1, x2, ec;
int i;
@mdmunir
mdmunir / timer_hidroponik.ino
Created Aug 9, 2017
Timer untuk pompa hidroponik menggunakan arduino nano dan rtc 1307 serta keypad
View timer_hidroponik.ino
#include <Wire.h>
#include <RealTimeClockDS1307.h>
#include <EEPROM.h>
#include <Keypad.h>
//RealTimeClock RTC;//=new RealTimeClock();
#define SET_TIME 't'
#define SWITCH_ON '1'
#define SWITCH_OFF '0'
@mdmunir
mdmunir / ImageController.php
Last active Jul 9, 2017
Yii2 Tinymce widget
View ImageController.php
<?php
namespace app\controllers;
use Yii;
use mdm\upload\FileModel;
use yii\web\NotFoundHttpException;
use yii\imagine\Image;
use yii\helpers\FileHelper;
use yii\web\UploadedFile;
@mdmunir
mdmunir / index.php
Created May 22, 2017
Yii2 Angualjs Route
View index.php
<?php
use yii\web\View;
use dee\angularjs\NgRoute;
//use yii\helpers\Html;
/* @var $this View */
?>
<div ng-app="test">
You can’t perform that action at this time.