Skip to content

Instantly share code, notes, and snippets.

View 25564's full-sized avatar

Cian 25564

View GitHub Profile
<?php
class Group {
public static function create($name, $permissions = array()){
//Creates a permissions group
if(strlen($name) > 0){
$insert = DB::getInstance()->table("groups")->insert(array(
'name' => $name,
'permissions' => json_encode($permissions)
));
if($insert){
@25564
25564 / Meta Tables
Last active August 29, 2015 14:18
A class which can stores methods to be executed when certain events happen. It can also be accessed via object notation or arrayaccess. These Meta Methods are fired on events such as attempting to access an unset variable and can be used to return another value such as default value. This is however just the begining.
<?php
/* -- Meta Methods --
NewIndex - When a new index is added
Modify - When an element is changed
Isset - When isset() is ran on a value
Unset - When unset() is ran
Index - When an element is requested that does not exist
Count - When count() is ran. This will exclude MetaMethods when counting elements
*/
@25564
25564 / Calculator.scala
Created March 18, 2016 03:20
CODE NETWORK!
object Calculator extends App {
def multiply(a:Int, b:Int) = a * b
def minus(a:Int, b:Int) = a - b
def add(a:Int, b:Int) = a + b
def divide(a:Int, b:Int) = a / b