Skip to content

Instantly share code, notes, and snippets.

View edwinlab's full-sized avatar
🐢
run

Edwin edwinlab

🐢
run
View GitHub Profile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
<?php
/**
* Kelas untuk memanipulasi data yang berkaitan dengan rupiah.
*
* Catatan: Saya lupa darimana contoh fungsi terbilang awalnya!
*
* @version 0.0.1
* @author Anggiajuang Patria <[email protected]>
* @copyright (c) 2009-2010 http://www.segellabs.com/
* @license http://www.gnu.org/licenses/gpl-3.0.txt
@edwinlab
edwinlab / truncate.rb
Created August 4, 2016 02:48
Truncate with regex to detection word
'Once upon a time in a world far far away'.truncate(20, separator: /\s/)
# "Once upon a time..."
@edwinlab
edwinlab / validate.rb
Created July 29, 2016 03:28
Checking string is valid date
def validate_date date
begin
Date.parse(date)
rescue ArgumentError
Date.today
end
end
@edwinlab
edwinlab / set-value.md
Created April 20, 2016 03:39 — forked from JeffreyWay/set-value.md
PHP: Set value if not exist

You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:

name = name || 'joe';

This is quite common and very helpful. Another option is to do:

name || (name = 'joe');
@edwinlab
edwinlab / gulpfile.js
Created March 14, 2016 09:15
Simple glupfile.js
var gulp = require('gulp'),
concat = require('gulp-concat'),
prefix = require('gulp-autoprefixer'),
sass = require('gulp-sass')
cleancss = require('gulp-clean-css'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify');
var cssDir = 'public/assets/css',