Skip to content

Instantly share code, notes, and snippets.

View danielhusar's full-sized avatar
🏂

Daniel Husar danielhusar

🏂
View GitHub Profile
function validateIBAN(iban) {
var newIban = iban.replace(/ /g, '').toUpperCase(),
modulo = function (divident, divisor) {
var cDivident = '';
var cRest = '';
for (var i in divident ) {
var cChar = divident[i];
var cOperator = cRest + '' + cDivident + '' + cChar;
@danielhusar
danielhusar / gruntfile.js
Last active December 22, 2015 15:49
Default grunt tasks without tests
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//concat files
concat: {
app : {
src: ['js/*.js', '!js/*min.js'],
dest: 'js/all.js'
/**
* From: html5rocks.com under APACHE2 Licence
* Copyright Google
**/
(function () {
var COUNT = 300;
var masthead = document.querySelector('.masthead');
var canvas = document.createElement('canvas');
@danielhusar
danielhusar / cookie
Created June 18, 2014 10:25
Bazos cookie for sending emails
@danielhusar
danielhusar / jQuery.js
Last active August 29, 2015 14:10
Simpliest jQuery ever
(function(window, document, undefined) {
function jQuery(selector) {
this.el = this.slice.call(document.querySelectorAll(selector));
this.length = this.el.length;
this.el.forEach(function (element, index) {
this[index] = element;
}, this);
@danielhusar
danielhusar / gist:ed64f570f54fdad31b41
Created June 12, 2015 12:41
Unsubscribe from all organisation repos
var auth_token = $("input[name='authenticity_token']")[0].value;
$(".js-subscription-row > a[href^='/ORGANISATION']").each(function($elem){
$.post("/notifications/subscribe", {
authenticity_token : auth_token,
do : 'included',
'repository_id' : $("form.js-unsubscribe-form [name='repository_id']", $(this).parent("li")).val()
});
});
@danielhusar
danielhusar / file.scss
Last active August 29, 2015 14:24
Nested mixin inside media queries
@mixin query {
@media only screen and (max-width: 8888888px) {
@content;
}
}
@media all and (min-width: 1px) {
body {
color: black;
var data = require('./data/users.json');
function distance(lat1, lon1, lat2, lon2) {
var radlat1 = Math.PI * lat1/180;
var radlat2 = Math.PI * lat2/180;
var radlon1 = Math.PI * lon1/180;
var radlon2 = Math.PI * lon2/180;
var theta = lon1 - lon2;
var radtheta = Math.PI * theta/180;
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
Computer Information:
Manufacturer: Apple
Model: MacBookPro9,1
Form Factor: Laptop
No Touch Input Detected
Processor Information:
CPU Vendor: GenuineIntel
CPU Family: 0x6
CPU Model: 0x3a
@danielhusar
danielhusar / components.my-component.js
Last active November 28, 2016 20:10
intercom-one-way
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
onChecked: function() {
this.checkboxCb();
}
}
});