Skip to content

Instantly share code, notes, and snippets.

View gormus's full-sized avatar
💭
Never be cruel, never be cowardly.

Osman Gormus gormus

💭
Never be cruel, never be cowardly.
View GitHub Profile
@gormus
gormus / CUSTOMMODULE.blazy.js
Last active April 8, 2018 05:18
Lazy load any image rendered via theme_image(). This is a simple Drupal 7 module to lazy-load all images generated via theme_image()
(function ($) {
Drupal.behaviors.CUSTOMMODULE = {
attach: function (context, settings) {
// @see http://dinbror.dk/blog/blazy/?ref=example-page#Options
var options = settings.CUSTOMMODULE.bLazy ? settings.CUSTOMMODULE.bLazy : {};
var bLazy = new Blazy(options);
}
};
}(jQuery));
@gormus
gormus / CUSTOMMODULE.module.php
Created March 23, 2018 06:51
Transform select-type exposed filters into jump menus.
<?php
// Rename this file to `CUSTOMMODULE.module`
/**
* Implements hook_form_FORM_ID_alter().
*/
function CUSTOMMODULE_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
// Replace `Size` filter.
CUSTOMMODULE_jumpmenu($form, 'field_size_tid');
@gormus
gormus / DomainBlackListValidator.php
Created January 14, 2018 20:07
Laravel validation rule to prevent use of email addresses possessing a disposable (blacklisted) domains.
<?php
// Namespace
namespace App\Validators;
// Using directives
use Cache;
use Carbon\Carbon;
// Domain black list validation class
@gormus
gormus / dynamic-image-colorizing-with-input-type-color.markdown
Created November 27, 2017 03:44
Dynamic Image Colorizing with <input type="color">

Dynamic Image Colorizing with

Removes chrome from color input swatch and overlays over an image, using blend modes to colorize. Voila! Color changing without JS.

Chrome and Firefox only right now.

A Pen by Osman on CodePen.

License.

@gormus
gormus / changelog.rb
Created November 16, 2017 05:49 — forked from ttscoff/changelog.rb
Generate release notes from git commit messages
#!/usr/bin/ruby
# A script to automate changelog generation from Git commit messages
#
# For use with a git-flow workflow, it will take changes from the last tagged release
# where commit messages contain NEW, FIXED, and IMPROVED keywords and sort and fromat
# them into a Markdown release note list.
#
# The script takes version information from the macOS command agvtool and bases
# the product name on the first matching Xcode Info.plist found
@gormus
gormus / simple_args_parsing.sh
Created October 21, 2017 04:46 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
<?php
/**
* Implements of hook_drush_command().
*/
function migration_filepath_drush_command() {
$items = array();
$items['migration_filepath'] = array(
'description' => "Move files to subdirectories",
'callback' => 'drush_migration_filepath',
@gormus
gormus / index.html
Created May 18, 2017 01:07
CCC - Quicklinks // source https://jsbin.com/zubixep
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>CCC - Quicklinks</title>
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/main.min.css" rel="stylesheet" type="text/css" />
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/jquery.mb.YTPlayer/jquery.mb.YTPlayer.min.css" rel="stylesheet" type="text/css" />
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/theme.min.css" rel="stylesheet" type="text/css" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/main.min.css" rel="stylesheet" type="text/css" />
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/jquery.mb.YTPlayer/jquery.mb.YTPlayer.min.css" rel="stylesheet" type="text/css" />
<link href="http://cms-prod.clackamas.edu/ResourcePackages/Bootstrap/assets/dist/css/theme.min.css" rel="stylesheet" type="text/css" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<style id="jsbin-css">