Skip to content

Instantly share code, notes, and snippets.

View dilantha's full-sized avatar

Dilantha Nanayakkara dilantha

View GitHub Profile
@dilantha
dilantha / closecisco.lua
Last active March 13, 2021 23:38
Close Cisco AnyConnect Notification on macOS Big Sur
ciscoTile = 'Cisco AnyConnect Secure Mobility Client Notification'
ciscoNotification = hs.window.get(ciscoTile)
if ciscoNotification then
ciscoNotification:close()
end
@dilantha
dilantha / macsetup.sh
Last active May 27, 2016 02:19
Mac setup
# Quick Look plugins https://github.com/sindresorhus/quick-look-plugins
## Preview source code files with syntax highlighting
brew cask install qlcolorcode
## Preview plain text files without or with unknown file extension. Example: README, CHANGELOG, index.styl, etc.
brew cask install qlstephen
## Preview Markdown files
brew cask install qlmarkdown
@dilantha
dilantha / java8ubuntu.sh
Created November 4, 2015 23:02
Install Java 8 on Ubuntu 14.04
# from http://ubuntuhandbook.org/index.php/2014/02/install-oracle-java-6-7-or-8-ubuntu-14-04/
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
java -version
@dilantha
dilantha / better_logic.php
Last active August 29, 2015 14:05
Coder maturity
<?php
// 2006
if ($payment_type != null) {
if ($payment_type == 'cash') {
if ($balance > 0) {
$status = 'credit';
} else if ($balance == 0) {
$status = 'cash';
}
@dilantha
dilantha / gist:8089372
Last active April 13, 2017 22:37
Laravel related model data population for multiple checkboxes
<?php
class Product extends Eloquent {
public function categories()
{
return $this->belongsToMany('Category');
}
}
@dilantha
dilantha / wp-import-laravel-3.php
Created September 17, 2013 11:04
Some WordPress import code in Laravel 3.
<?php
class Import_Controller extends Base_Controller {
public $restful = TRUE;
public function get_index()
{
// code here..
@dilantha
dilantha / ubuntu_lamp.sh
Last active December 16, 2015 07:08
Standard LAMP on Ubuntu
# Apache
sudo aptitude install apache2 apache2-mpm-prefork apache2-utils apache2.2-common
sudo a2enmod rewrite
# Server name
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
# Restart Apache
sudo service apache2 restart
@dilantha
dilantha / hack.sh
Created April 3, 2012 02:57 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#