Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mogetutu's full-sized avatar

Isaak Mogetutu mogetutu

View GitHub Profile
@mogetutu
mogetutu / exercise12-example.php
Created February 10, 2014 13:45
Akirachix, Exercise 12 - Example
<?php
// the year the use passing is a leap year
// then assign feb 28/29
// $timestamp = strotime('2013-01-01')
// date('L', $timestamp)
function isLeapYear($year)
{
// Tell us if this is a leap year
$isLeapYear = date('L', strtotime("$year-01-01"));
@mogetutu
mogetutu / person.php
Created February 17, 2014 09:36
OOP - Class Person
<?php
class Person
{
public $name;
public $age;
public $favourite_food;
function __construct($name = "Name not defined", $age = "Age not defined", $favourite_food = "No Favourite Food")
{
$this->name = $name;
@mogetutu
mogetutu / minify.rake
Created February 24, 2014 05:40
Minify Rake Task
require "reduce"
source_dir = "source" # source file directory
public_dir = "public" # compiled site directory
desc "minifies static files"
task :minify do
puts "## Compressing static assets"
original = 0.0
compressed = 0
@mogetutu
mogetutu / get.php
Created March 3, 2014 11:58
POST and GET examples
<!-- GET -->
<?php
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$subjectone = $_GET['subjectone'];
$subjecttwo = $_GET['subjecttwo'];
$subjectthree = $_GET['subjectthree'];
$subjectfour = $_GET['subjectfour'];
$subjectfive = $_GET['subjectfive'];
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from

How to Install MySQL 5.5 on Ubuntu 12.04 Linux

MySQL is the most trusted and depended-on open source database platform in use today. As such, 9 out of the top 10 most popular and highly trafficked websites in the world rely on MySQL primarily due to its ubiquity across heterogeneous platforms and application stacks and for its well-known performance, reliability and ease of use. This blog entry will guide you through the step-by-step installation of MySQL 5.5 on Ubuntu Linux 12.04 LTS 32 bit. This installation is performed on a clean installation of Ubuntu Server 12.04 32 bit.

Step 1: Open your Terminal

Press the following keyboard shortcut:

Ctrl + Alt + T

Creating your own Custom Live 11.04 CD.

1. Preparations

First you download the Live CD ISO. While it is downloading install some software that is needed for rebuilding: sudo apt-get install squashfs-tools dchroot

  • Squashfs Install squashfs-tools is a compressed read-only filesystem for Linux.
  • dchroot Install dchroot allows users to execute commands or interactive shells in different chroots.

Mount the Live CD:

require 'benchmark'
class SlowTrie
attr_accessor :word, :nodes
def initialize
@word, @nodes = false, {}
end
def <<(word)
#!/usr/bin/env ruby
# Please read http://otobrglez.opalab.com for more information about this code.
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
<?php
# Separated with comma. Empty string - all ips allowed.
# Look in admin panel for GitHub public IP's
# Example: '127.0.0.1, 192.168.1.1'
define('__ALLOWED_IPS__', '94.45.140.46, 207.97.227.253, 50.57.128.197');
# Emails to send sync results
define('MAIL_TO', 'johndoe@example.com');
# Mail everything, including logs.