Skip to content

Instantly share code, notes, and snippets.

Avatar
💌
🦨🦨🦨🦨🦨🦨🦨🦨🦨

Joel Larsson bolmaster2

💌
🦨🦨🦨🦨🦨🦨🦨🦨🦨
View GitHub Profile
View openpgp.md
View keybase.md

Keybase proof

I hereby claim:

  • I am bolmaster2 on github.
  • I am bolmaster2 (https://keybase.io/bolmaster2) on keybase.
  • I have a public key whose fingerprint is D7A9 7067 1212 271E 6C54 34FD 55B7 AB6C 3AD8 CC01

To claim this, I am signing this object:

View Naming conventings of branches
# Naming conventions of branching.
Stolen mostly from [https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#type]
- feature: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- performance: A code change that improves performance
@bolmaster2
bolmaster2 / rem-mixin.scss
Created Oct 12, 2013
rem mixins using a strip unit function
View rem-mixin.scss
@function strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@mixin rem($size: 1.6) {
font-size: ($size * 10) + px;
font-size: (($size * 10) / strip-unit($base_font_size)) + rem;
}
@bolmaster2
bolmaster2 / curl-closure-compiler-shell.sh
Created Sep 3, 2013
Concatenate and minify your JS-files with closure compiler API using curl
View curl-closure-compiler-shell.sh
#!/bin/bash
output_file='all.min.js'
tmp_file='tmp.js'
cat my_js_1.js my_js_2.js > $tmp_file
curl -d compilation_level=SIMPLE_OPTIMIZATIONS -d output_format=text -d output_info=compiled_code --data-urlencode "js_code@${tmp_file}" http://closure-compiler.appspot.com/compile > $output_file
rm $tmp_file
@bolmaster2
bolmaster2 / is_touch_device.js
Created Feb 27, 2013
Checks if ontouchstart exists in window-object
View is_touch_device.js
function is_touch_device() {
return !!('ontouchstart' in window);
}
@bolmaster2
bolmaster2 / jquery-touch-click.js
Created Feb 27, 2013
jQuery plugin to make event for both "click" and "touchend" depending on if its a touch device or not
View jquery-touch-click.js
/**
* jQuery plugin to make event for both "click" and "touchend" depending on if its a touch device or not
*/
(function($){
$.fn.touchClick = function(callback) {
var eventType = is_touch_device() ? "touchend" : "click";
this.each(function() {
$(this).bind(eventType, callback);
if (eventType == "touchend") {
$(this).click(function(e) {e.preventDefault();});
@bolmaster2
bolmaster2 / placeholder-helper.scss
Created Feb 26, 2013
Use a mixin to style placeholder input text cross browser
View placeholder-helper.scss
// use one mixin for styling placeholder input text cross browser
@mixin placeholder ($color) {
/* WebKit browsers */
::-webkit-input-placeholder {
color: $color;
}
/* Mozilla Firefox 4 to 18 */
input:-moz-placeholder,
textarea:-moz-placeholder {
color: $color;
@bolmaster2
bolmaster2 / gist:1570347
Created Jan 6, 2012
Batch conversion of png to jpg
View gist:1570347
mogrify -format jpg -quality 80 *.png
@bolmaster2
bolmaster2 / show_range_values.js
Created Sep 12, 2011
Show the html5 input type range values
View show_range_values.js
// show the html5 input type range values
function show_ranges() {
// selector and classname on the range value
var selector = "input[type=range]",
class_name = "range-value";
// get the range values with jquery
var ranges = $(selector);
// check for support for the html5 range input and then show the value from the range