Skip to content

Instantly share code, notes, and snippets.

View Madawar's full-sized avatar

Dennis Wanyoike Kuria Madawar

View GitHub Profile
@Madawar
Madawar / SyntaxHighlightercore
Created December 15, 2012 14:09
Syntax Highlighter Core
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
/**
* SyntaxHighlighter
* http://alexgorbatchev.com/SyntaxHighlighter
*
* SyntaxHighlighter is donationware. If you are using it, please donate.
* http://alexgorbatchev.com/SyntaxHighlighter/donate.html
*
* @version
* 3.0.83 (July 02 2010)
*
@Madawar
Madawar / Custom Templates
Created December 10, 2013 11:45
Example of Custom Templates
<!-- General input with icons -->
<div class="form-group <%=formclass %>">
<label for="<%= elementid %>"><%= label %></label>
<div class="input-group">
<span class="input-group-addon"><i class="fa <%= icon %>"></i></span>
<input class="form-control <%= extra %>" type="<%= type %>" name="<%= name %>" placeholder="<%= placeholder %>">
</div>
<p class="help-block"><%= helpblock %></p>
</div>
@Madawar
Madawar / form_partial.mak
Created April 27, 2014 17:33
Using Html Fill in Pyramid Framework
<form method="POST" action="">
<div class="form-group ">
<label for="name">Your Name</label>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input type="text" class="form-control" name="name" id="name" placeholder="John Doe">
</div>
<p class="help-block">Please enter your full names</p>
</div>
<div class="form-group ">
@Madawar
Madawar / __init__.py
Created May 4, 2014 18:07
Example of a simple Pyramid plugin
# -*- coding: utf-8 -*-
"""
Created on 05/03/14
@author: dwanyoike
Example of a pyramid Framework Addon
"""
from zope.interface import Interface
@Madawar
Madawar / callable.php
Last active August 29, 2015 14:17
Introduction to Closures in Php. in start.php we bind a closure to a class instance. In firstclosure.php we pass a closure to a class method in callable.php we improve the firstclosure.php class and finally in laravelstyle we explore how to call methods in laravel style read the blog at http://codedcell.com
<?php
/**
* Created by PhpStorm.
* User: dwanyoike
* Date: 03/03/15
* Time: 09:29
*/
class Addition
{
@Madawar
Madawar / CleanOutAndroidAndMobilePhones
Last active July 18, 2016 07:44
Clean out Mobile devices from your DHCP by using a powershell script.
#Put your server Scope
$scope = "192.168.1.0"
#Put your DHCP Server Name
$dhcpserver = "dhcpserver.contoso.com"
#Fileshare unc path. Your Shared CSV file should have atleast one column Mac with the Mac-Address in the format E0-19-27-42-92-AC
$AllowedList = "\\shareserver\ITSoftware\MacAddress.csv"
#Get Active Leases
$leases = Get-DhcpServerv4Lease -ComputerName $dhcpserver -ScopeId $scope | Where-Object {$_.HostName -like 'android-*' -or $_.HostName -like 'Windows-*' -or $_.HostName -like '*Nokia*' -or $_.HostName -like '*Phone*'}
#Get Allowed CSV put this file in a shared folder and put in CSV file name here
@Madawar
Madawar / DomPDF Fix
Created September 7, 2016 06:41
DOmPDF for PHPExcel Fix
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<img v-on:click="expand" src="https://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png" id="app"/>
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
minfds=10000
[program:php]
command=%(ENV_SUPERVISOR_PHP_COMMAND)s
user=%(ENV_SUPERVISOR_PHP_USER)s