Skip to content

Instantly share code, notes, and snippets.

Mathuvathanan Mounasamy cowboymathu

Block or report user

Report or block cowboymathu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cowboymathu
cowboymathu / 1-add-middleware.php
Created Feb 15, 2018 — forked from adamwathan/1-add-macros.php
Multiformat Endpoints in Laravel
View 1-add-middleware.php
<?php
namespace App\Http\Middleware;
class CaptureRequestExtension
{
public function handle($request, $next)
{
if ($request->route()->parameter('_extension') !== null) {
$request->attributes->set('_extension', substr($request->route()->parameter('_extension'), 1));
@cowboymathu
cowboymathu / touchcursor_mode.json
Created Sep 8, 2017
TouchCursor Karabiner-Elements json
View touchcursor_mode.json
{
"title": "TouchCursor Mode",
"rules": [
{
"description": "TouchCursor Mode [Space as Trigger Key]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "spacebar",
View search_and_replace_database.php
<?php
// Find and replace facility for complete MySQL database
//
// Written by Mark Jackson @ MJDIGITAL
// Can be used by anyone - but give me a nod if you do!
// http://www.mjdigital.co.uk/blog
// SEARCH FOR
$search = '**__FIND_THIS__**';
View preventSpam.js
function escapeAll(str) {
var hexString = "";
for (var index=0; index<str.length; index++) {
var charCode = str.charCodeAt(index);
var h = charCode.toString(16).toUpperCase();
if (h.length == 1) {
h = "0" + h;
}
h = "%" + h;
hexString += h;
@cowboymathu
cowboymathu / center-css
Created Apr 21, 2015
magnific-popup center css
View center-css
<style>
.album-billede-box-pop {
width: 100%;
text-align: center;
}
.album-billede-single-pop {
display: inline-block;
}
</style>
@cowboymathu
cowboymathu / showImages.php
Created Sep 10, 2014
Show images in directory recursively
View showImages.php
<?php
/*
Show images recursively in a directory v1.0
Author: Mathuvathanan Mounasamy
Licensed under the MIT license
*/
showImages('media/catalog/product/F');
function showImages($directory) {
@cowboymathu
cowboymathu / correctImageOrientation.php
Last active Mar 26, 2019
Rotate archived images to correct orientation
View correctImageOrientation.php
<?php
/*
Correct image orientation v1.0
Author: Mathuvathanan Mounasamy
Licensed under the MIT license
This funtion correct all the images' orientation in a given path or directory.
@cowboymathu
cowboymathu / count_array.rb
Created Oct 25, 2011
Count array elements
View count_array.rb
arr = [1,2,3,4,5,3,4,5,2,3,3,4]
arr.inject(Hash.new(0)) { |h, e| h[e] += 1 ; h }
View user_role_association.rb
Factory.define :user_with_role, :parent => :user do |user|
user.after_create { |p| Factory(:role, :users => [p]) }
end
@cowboymathu
cowboymathu / qtip-ajax-demo.js
Created Oct 12, 2011
qTip Ajax demo sample
View qtip-ajax-demo.js
<script class="example" type="text/javascript">
// Create the tooltips only on document load
$(document).ready(function()
{
// Make sure to only match links to wikipedia with a rel tag
$('a[href*=wikipedia.org/][rel]').each(function()
{
// We make use of the .each() loop to gain access to each element via the "this" keyword...
$(this).qtip(
{
You can’t perform that action at this time.