Skip to content

Instantly share code, notes, and snippets.

View Jones-S's full-sized avatar

Jonas Jones-S

  • Zürich
View GitHub Profile
@ValeriiVasin
ValeriiVasin / gist:1556806
Created January 3, 2012 20:36
[javascript patterns] Decorator.
var Sale = function (price) {
this.price = price > 0 ? price : 100;
this.decorators_list = [];
};
Sale.decorators = {};
Sale.decorators.fedtax = {
getPrice: function (price) {
return price + price * 0.05;
@iambibhas
iambibhas / scopes.txt
Last active June 16, 2024 20:45
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@AugustMiller
AugustMiller / map.js
Last active October 2, 2021 14:14
Map a number in one range to a number in another.
function mapNumber (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
@d-simon
d-simon / Commit_Guidelines.md
Last active January 31, 2021 10:43
Commit Guidelines

Commit Message Guidelines

This is a proposal for structuring commit messages. It is a set of guidelines evolved from a need to scan, review and navigate commits quickly. They are ment to bring clarity to the commit history while retaining a lot of flexibility.

Structure

[Action] Scope: Summary

(Involved Commits)
@xposedbones
xposedbones / map.js
Last active June 17, 2024 02:30
Javascript Map range of number to another range
Number.prototype.map = function (in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
@Jakobud
Jakobud / _leastSquaresFit.scss
Last active November 26, 2017 02:05
Least Squares Fit Linear Regression SASS function
/// leastSquaresFit
/// Calculate the least square fit linear regression of provided values
/// @param {map} $map - A SASS map of viewport width and size value combinations
/// @return Linear equation as a calc() function
/// @example
/// font-size: leastSquaresFit((576: 24, 768: 24, 992: 34));
/// @author Jake Wilson <[email protected]>
@function leastSquaresFit($map) {
// Get the number of provided breakpoints