Skip to content

Instantly share code, notes, and snippets.

View ardani's full-sized avatar
🎯
Focusing

Ardani Rohman ardani

🎯
Focusing
View GitHub Profile
@ardani
ardani / datediff.php
Last active August 29, 2015 13:57
Pengurangan Tanggal Dengan PHP
<?php
function date_diff($d1, $d2)
{
$d1 = (is_string($d1) ? strtotime($d1) : $d1);
$d2 = (is_string($d2) ? strtotime($d2) : $d2);
$diff_secs = abs($d1 - $d2);
$base_year = min(date("Y", $d1), date("Y", $d2));
$diff = mktime(0, 0, $diff_secs, 1, 1, $base_year);
return array(
"years" => date("Y", $diff) - $base_year,
<?php
/**
* @author Ihsan Faisal
*/
class EscapeCommand
{
const ESC = "\x1B";
private $commands = "";
@ardani
ardani / Float-Bootstrap-Labels.markdown
Created December 24, 2014 10:31
Float Bootstrap Labels

Float Bootstrap Labels

Float Bootstrap Labels on input fields and textareas

  • Automatically adding * on required fields
  • Highlighting required fields on focus
  • Highlighting invalid fields always

Inspired by:

http://css-tricks.com/float-labels-css/

@ardani
ardani / Bootstrap-2-Moving-Box-Carousel---IE.markdown
Created December 24, 2014 10:34
Bootstrap 2 Moving Box Carousel - IE
@ardani
ardani / Super-Simple-Bootstrap-Responsive-Timeline.markdown
Created December 24, 2014 10:58
Super Simple Bootstrap Responsive Timeline
@ardani
ardani / Side-Tabs-for-Bootstrap.markdown
Created December 24, 2014 10:59
Side Tabs for Bootstrap

Side Tabs for Bootstrap

This is just playing around with the idea of side tabs for tabbed navigation in bootstrap 3.

This is still a work in progress.

A Pen by Liam Conrad on CodePen.

License.

// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@ardani
ardani / Angular-JS---Basic-app.markdown
Created January 4, 2015 22:03
Angular JS - Basic app
// Create the query as below (Note: "CUSTOMTAG" added for altering the query)
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', array('post', 'document', 'link'), 'IN')
->propertyCondition('status', 1)
->fieldCondition('og_group_ref', 'target_id', $panel_args[0], '=');
// Added the Tag, which we will be using to alter the query.
->addTag('CUSTOMTAG');
// Complete the query (if you are having any other field condition).
->execute();
@ardani
ardani / mymodule_test.module
Created March 26, 2015 06:53
Redirect a form after its submitted using Drupal 7
// add your own submit function to drupal's user_login form
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_login') {
// $form['#submit'] is an array that contains all functions to run when form is submitted
$form['#submit'][] = 'mymodule_login_redirect';
}
}
// this is the function you entered to run above
function mymodule_login_redirect($form, &$form_state) {