Skip to content

Instantly share code, notes, and snippets.

View gayanvirajith's full-sized avatar
:octocat:

Gayan Virajith gayanvirajith

:octocat:
View GitHub Profile
@gayanvirajith
gayanvirajith / after-render.js
Created August 26, 2015 06:25
Angular after render directive trick
define(['angular'], function (angular) {
'use strict';
return angular.module('app.common.after-render', [])
.directive('afterRender', [ '$timeout', function($timeout) {
var def = {
restrict : 'A',
terminal : true,
transclude : false,
link : function(scope, element, attrs) {
@gayanvirajith
gayanvirajith / DecimalDemo.java
Last active August 29, 2015 14:02
Format decimal value into two decimal in swing
/**
* Format decimal value into two decimal in swing
* @author: Gayan Virajith
* @url: webcreate.lk
* @email: gayanvirajith@gmail.com / webcreatelk@gmail.com
*/
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.text.DecimalFormat;
@gayanvirajith
gayanvirajith / style.css
Last active August 29, 2015 14:02
Simple typography styles
/**
* Simple typography base css
* Author: Gayan Virajith
* URL: gayanvirajith@github.io
*/
/**
* Quick and dirty way to get rid of unnecessary padding
* and margins from the various elements.
*/
@gayanvirajith
gayanvirajith / border-radius-mixin.scss
Last active August 29, 2015 14:03
Sass border radius mixin
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
@gayanvirajith
gayanvirajith / transition-mixin.scss
Created July 9, 2014 10:19
Sass transition mixin
@mixin transition($args...) {
-webkit-transition: $args;
-moz-transition: $args;
-ms-transition: $args;
-o-transition: $args;
transition: $args;
}
@gayanvirajith
gayanvirajith / layout.html
Created July 9, 2014 10:25
HTML 5 template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Html5 Template</title>
<!-- Main stylesheet -->
<link href="css/style.css" rel="stylesheet">
@gayanvirajith
gayanvirajith / layout.scss
Last active August 29, 2015 14:03
Sass media query mixin
// -----------------------------------------------------
// Extra small screen / phone
$screen-xs: 480px;
// Small screen / tablet
$screen-sm: 768px;
// Medium screen / desktop
$screen-md: 992px;
@gayanvirajith
gayanvirajith / .vimrc
Last active August 29, 2015 14:03
Enable soft tabs, ruler in VIM Editor
"------------------------------------------------------------
" To control the number of space characters that will be inserted when the
" Tab key is pressed, set the 'tabstop' option. For example, to insert 4 spaces for a tab
"------------------------------------------------------------
set tabstop=4
"------------------------------------------------------------
" makes the spaces feel like real tabs.
"------------------------------------------------------------
set softtabstop=4
@gayanvirajith
gayanvirajith / iptable-allow-httpd
Created July 16, 2014 05:06
Iptable add rule temporarily accept port 80 from outside.
iptables -I INPUT 1 -p tcp --dport http -j ACCEPT
@gayanvirajith
gayanvirajith / sample-virtual-host.conf
Last active August 29, 2015 14:04
Sample virtual host
<VirtualHost *:80>
DocumentRoot "/home/gayan/dev/html/"
ServerName html.local
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/home/gayan/dev/html/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All