Skip to content

Instantly share code, notes, and snippets.

View mkhuda's full-sized avatar
🎯
Focusing

Lek Huda mkhuda

🎯
Focusing
View GitHub Profile
@mkhuda
mkhuda / proses-kuesioner.php
Created October 26, 2014 16:10
proses-kuesioner.php
<?php
session_start();
$indikator = $_SESSION['indikator'];
$namauser = $_SESSION['username'];
$usernim = $_SESSION['nim'];
include 'config.php';
@mkhuda
mkhuda / konten-mahasiswa.php
Created October 26, 2014 16:11
konten-mahasiswa.php
<div id="konten-mahasiswa">
<?php include "config.php"; ?>
<div class="row-fluid">
<div class="span12">
<img class="img-circle" data-src="holder.js/140x140" alt="140x140" style="width: 140px; height: 140px;" src="images/kuesioner-logo.png">
<div class="caption">
<h3>Isi Voting Kepala Sekolah</h3>
<p>Silahkan mengisi voting yang telah kami sediakan. Voting ini dapat Anda gunakan untuk memilih kepala sekolah.</p>
@mkhuda
mkhuda / kuesioner-dynamic.php
Created October 26, 2014 17:33
kuesioner-dynamic.php
<?php
session_start();
if (isset($_SESSION['level']))
{
if ($_SESSION['level'] == "admin")
{
}
else if ($_SESSION['level'] == "user")
@mkhuda
mkhuda / Gradle_Adb_Plugin.gradle
Created November 5, 2015 19:36 — forked from mohsenk/Gradle_Adb_Plugin.gradle
Gradle task for connect adb to android device over wifi network
import groovy.swing.SwingBuilder
task adbConnect(type: Exec) {
doFirst {
new SwingBuilder().edt {
dialog(modal: true,
title: 'Enter password',
alwaysOnTop: true,
resizable: false,
locationRelativeTo: null,
@mkhuda
mkhuda / kwh.php
Created January 24, 2016 04:49
Menghitung Rentang Harga KwH (Kilo Watt Hour) Listrik dengan PHP
<?php
// Fungsi untuk menghitung Rentang Harga Kwh PLN Indonesia
// Array KWH
$array = array('450 Kwh', '900 Kwh', '1300 Kwh', '2200 Kwh', '3500 Kwh');
// Harga Kwh
$arrayharga = array('1250000', '1650000', '2050000', '2850000', '4200000');
@mkhuda
mkhuda / migrating-from-mysql-to-postgres.rst
Created April 10, 2016 16:48 — forked from igniteflow/migrating-from-mysql-to-postgres.rst
Migrating from MySQL to Postgres in Ubuntu

Migrating from MySQL to Postgres in Ubuntu

Dump your database:

mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root databasename

Convert the dump to Postgres syntax using https://github.com/lanyrd/mysql-postgresql-converter:

wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py
execute pathogen#infect()
call pathogen#helptags()
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
syntax on
set autoindent
set cindent
set shiftwidth=2
set tabstop=2
set number
inoremap { {<CR>}<up><end><CR> }
@mkhuda
mkhuda / sidekiq
Last active October 23, 2016 09:07
Sidekiq init.d configuration with .rbenv
#!/bin/sh
# File: /etc/init.d/sidekiq
# thanks to http://tsaith.github.io/install-sidekiq-and-redis-on-ubuntu.html
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
@mkhuda
mkhuda / sidekiq.service
Last active June 28, 2022 23:15
Sidekiq service auto start for Ubuntu 16.04 using Systemd
#
# Sidekiq auto start using systemd unit file for Ubuntu 16.04
#
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
@mkhuda
mkhuda / array_of_hashes.rb
Last active June 3, 2017 01:25
Creating Array of Hashes with Ruby
def self.create_aoh
aoh_hash = { project: [] }
self.all.each do |order|
aoh_hash[:orders] << {
text: order.texts.pluck(:id),
text_count: order.texts.pluck(:words),
doc: order.documents.pluck(:id),
doc_count: order.documents.pluck(:words)
}
end