Skip to content

Instantly share code, notes, and snippets.

View bhalash's full-sized avatar
💭
🌈

Mark bhalash

💭
🌈
  • Ireland
View GitHub Profile
@bhalash
bhalash / regex.rb
Created November 18, 2015 17:05
String regex test
str = 'This hyperlink should be stripped out: http://www.bhalash.com. word www.google.ie, more word https://www.twitter.com!'
regex = /(\b(http(s?)|www).*?(?=(\s|[[:punct:]]\s|.(?=$))))/
p = str.scan(regex).each { |url|
link = url[0]
link_text = url[0]
link_href = url[0]
if !link_href.match(/^http(s?):\/\//)
@bhalash
bhalash / SassMeister-input.scss
Last active December 13, 2019 16:59
Modular Scale Functions
// ----
// libsass (v3.2.5)
// ----
// Validated against http://www.modularscale.com/
// http://www.modularscale.com/?1&&1.5&web&text
$mod-scale--size: 1rem !default;
$mod-scale--ratio: 1.5 !default;
@function modular-scale($increment, $base-size, $ratio) {
@bhalash
bhalash / readme.md
Created September 30, 2015 22:33 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

@bhalash
bhalash / SassMeister-input.scss
Created September 16, 2015 08:11
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@mixin selectorer($selector: null) {
&#{if($selector, ' ' + unquote($selector), $selector)} {
background: center/100% auto no-repeat url('foo');
}
}
@bhalash
bhalash / datechecker.js
Last active September 6, 2015 19:57
Datechecker
/**
* Time and Date Checker
* -----------------------------------------------------------------------------
* Does:
*
* 1. Append either time (hour:minute) or date (day/month/year) selects to
* target element.
* 2. Selects are prefixed with a given string, and suffixed with the input
* type foo_year, foo_month, etc.
* 3. A given time and date can be provided by a Unix timestamp, and the inputs
@bhalash
bhalash / .vimrc
Created August 24, 2015 08:55
Vimrc
" Set mode for backspace use.
set nocompatible
" Enable syntax highlighting
syntax on
" Change backspace for OSX
set backspace=indent,eol,start
" Enable line numbers.
@bhalash
bhalash / asym-float.scss
Last active August 29, 2015 14:27
Arbitrary Scss columns
/**
* Asymmetrical Floated Elements
* -----------------------------------------------------------------------------
* float-of() provides regularly-sized floated columns side by side. This allows
* for an asymmetrical structure. SIZES ARE INCLUSIVE OF MARGIN, EXCEPT IN
* PERCENTAGE COLUMNS.
*
* Seriously -- do NOT use this mixin for regularly-spaced columns. Use
* float-of() if you need regular columns, because the right margin will look
* all fucked. This is *only* for asymmetric columns.
@bhalash
bhalash / Updated lightbox.js
Last active November 5, 2017 04:28
Simple Lightbox
;(function($, window, document, undefined) {
'use strict';
$.fn.addLightbox = $.fn.addLightbox || function(args) {
var defaults = {
classes: {
hasLightbox: 'has-lightbox',
lightbox: 'rmwb-lightbox'
},
imgData: {
@bhalash
bhalash / miley.php
Last active August 29, 2015 14:24
An expiry timer, for Miley <3
<?php
/*
* Get, Set and Check Twerking time
* -----------------------------------------------------------------------------
* @param string $content Post content.
* @return string $content Post content.
*/
function for_miley_cyrus($content) {
@bhalash
bhalash / ie_media.scss
Last active December 2, 2015 11:35
CSS media queries to target versions of Internet Explorer
/**
* Internet Explorer
* -----------------------------------------------------------------------------
* I am happy to exclude Internet Explorer 11 because it is decently good. My
* IE problems inecrease exponentially as I work backwards in time.
*
* @link http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/
* @link http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/media-tests/
* @link http://www.limecanvas.com/css-hacks-targeting-ie-10/
* @link http://www.paulirish.com/2009/browser-specific-css-hacks/