Skip to content

Instantly share code, notes, and snippets.

@nim579
nim579 / bFormsLoader.css
Created December 27, 2013 13:25
Progress bar stripes on CSS3
.bFormsLoader {
position: relative;
}
@-webkit-keyframes progress-bar-stripes {
0% {
background-position: 0 0;
}
100% {
background-position: 40px 0;
}
@nim579
nim579 / getWeekOfMonth.js
Created January 10, 2014 14:39
Return week of month in Date class
Date.prototype.getWeekOfMonth = function(exact) {
var month = this.getMonth()
, year = this.getFullYear()
, firstWeekday = new Date(year, month, 1).getDay()
, lastDateOfMonth = new Date(year, month + 1, 0).getDate()
, offsetDate = this.getDate() + firstWeekday - 1
, index = 1 // start index at 0 or 1, your choice
, weeksInMonth = index + Math.ceil((lastDateOfMonth + firstWeekday - 7) / 7)
, week = index + Math.floor(offsetDate / 7)
;
@nim579
nim579 / measureSpeed.coffee
Created January 27, 2014 08:28
Measure client network connection speed
class measureSpeed
measureAttempts: 5
constructor: (done, process)->
measureProcess = new $.Deferred()
measurements = []
attempts = 0
average =
mbps: 0
mbs: 0
bs: 0

Keybase proof

I hereby claim:

  • I am nim579 on github.
  • I am nim579 (https://keybase.io/nim579) on keybase.
  • I have a public key ASBnDGlqhiynaUQxnDazqpTifHTuDgc-sq_gVs9ldKpiowo

To claim this, I am signing this object:

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (Buffer){
window.Buffer = Buffer
}).call(this,require("buffer").Buffer)
},{"buffer":3}],2:[function(require,module,exports){
'use strict'
exports.byteLength = byteLength
exports.toByteArray = toByteArray
@nim579
nim579 / IndexedList.coffee
Created November 12, 2021 11:15
List (Object[]) with index and uniq index fields
_ = require('lodash')
reorder = (object)->
newObj = {}
Object.keys(object).sort().forEach (key)->
newObj[key] = object[key]
return newObj