Skip to content

Instantly share code, notes, and snippets.

View bhalash's full-sized avatar
💭
🌈

Mark bhalash

💭
🌈
  • Ireland
View GitHub Profile
@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 / 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
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 / 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 / avatars.md
Created November 27, 2015 11:42
Avatars
@bhalash
bhalash / branches.md
Last active December 1, 2015 14:36
How to Branch a Git Repository

Git Branches

[![][2]][1]

An active git repository will look like a tree:

  • The master branch is the trunk of the tree.
  • The side branches are...branches of the tree.

Branching a Repository

Before a branch can be created on the server, it must first be created on your computer. All branches in a repository are instigated in a client computer, in your local copy.

@bhalash
bhalash / batch_rename.sh
Last active December 1, 2015 20:27
Batch French-> English rename
#!/usr/bin/env zsh
if [ ! -d "${1}" ]; then
echo "'${1}' is not a valid directory!"
exit 1
fi
cd "${1}"
# Months
@bhalash
bhalash / capybara_authlogic.md
Last active January 17, 2019 07:13
Capybara, RSpec and AuthLogic

RSpec, Capybara and AuthLogic

This gist is dedicated to all of my fellow clueless n00bs who are frightened by the combination of [RSpec][1], [Capybara][2] and [Authlogic][3].

This gist will not tell you how to install Ruby, Rails, RSpec, Capybara or Authlogic. For the most part, you can install any of these by running either:

brew install <packagename>
bundle install <packagename>

At the point in time that you reach this gist, you should have all of them installed.

@bhalash
bhalash / dropbox_sort.sh
Created December 19, 2015 23:12
Image Import Sorter
#!/usr/bin/env bash
# Blame Mark ([email protected]) for this.
function trim_spaces() {
# Safely remove spaces in the file name.
new_name=$(sed 's/[[:space:]]/_/g' <<< "${1}")
mv "$1" $new_name && echo $new_name
}
function test_aspect_ratio() {
@bhalash
bhalash / instasort_1.sh
Last active January 1, 2016 09:35
Instagram Sorter
#!/bin/bash
# https://www.bhalash.com/archives/13544793955
# April 23, 2013
# Need to escape the source path both as when we declare and use it, or Errors Occur.
IFS=' '
src="/home/bhalash/Dropbox/Camera Uploads/"
destination="/home/bhalash/Dropbox/Photos/Instagram"
temp=/tmp/instafind