Skip to content

Instantly share code, notes, and snippets.

View edomaru's full-sized avatar

Eding Muhamad edomaru

View GitHub Profile
@edomaru
edomaru / jQueryLive.js
Created December 19, 2013 03:13
live() function for jQuery above 1.3
var count = 0;
$("body").on({
click:function(){
$(this).after("<p>Another paragraph! "+(++count)+"</p>");
}
}, "p");
@edomaru
edomaru / setSelectedOption.js
Created January 18, 2014 03:12
Set Selected Option on HTML select element
// author http://stackoverflow.com/users/112407/rune-fs
$("div.id_100 option:selected").prop("selected",false);
$("div.id_100 option[value=" + value + "]").prop("selected",true);
@edomaru
edomaru / gist:9342207
Created March 4, 2014 08:10
The simple way to export excel from codeigniter
<?php
class Eksport extends CI_Controller {
function export() {
$file_name = "Nama file.xls";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename={$file_name}");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
$data = array(
@edomaru
edomaru / install-Ruby-2.2-on-ubuntu-14.04.md
Last active August 29, 2015 14:21
Install Ubuntu 2.2 on Ubuntu 14.04 LTS

#Install dependencies

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

#Install Ruby with rbenv

@edomaru
edomaru / Install-Rails-4.2-on-ubuntu-14.04.md
Last active October 28, 2018 15:31
Install Rails 4.2 on Ubuntu 14.04 LTS

Install Rails 4.2

Before install Rails 4.2, we need to install node.js first

sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@edomaru
edomaru / Git Commands Cheatsheet.md
Last active August 29, 2015 14:21
Git Commands Cheatsheet

Git Commands cheatsheet

Basic

Undoing Changes

Inisialisasi Git

$ git init

@edomaru
edomaru / Enable or disable device on ubuntu 14.04.md
Last active October 5, 2023 20:52
Enable or disable device on ubuntu 14.04

Enable or disable device on ubuntu 14.04

type xinput and see the device id

$ xinput

To disable device, type this line

$ xinput --disable xx xx adalah id device

@edomaru
edomaru / Serialize-unserialize-issue.php
Last active August 29, 2015 14:22
Serialize-unserialize-issue
//to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
// to update serialized data
$data = unserialize($serializedData);
if(array_key_exists('key', $data) {
$data['key'] = 'New Value';
@edomaru
edomaru / jquery-command-for-table-manipulation.md
Created June 4, 2015 08:07
jQuery Command for table manipulation

Add new row to the last row of table

$('#myTable tr:last').after('<tr>...</tr><tr>...</tr>');

Remove current row of the table

$(this).closest('tr').remove();
@edomaru
edomaru / jQuery Command for form.md
Last active August 29, 2015 14:22
jQuery Command for form

Type in one input field and show in other input field realtime. Also replace non alpha numeric with empty space and replace space with underscore.

$('body').on('keyup', '.input-label', function(event) {
     var me = $(this);
     var valOfme = me.val();   
     valOfme = valOfme.replace(/[^a-zA-Z 0-9]+/g,'').replace(/\s+/g,'_');
     me.closest('tr').find('input.input-field').val(valOfme);   
});