Skip to content

Instantly share code, notes, and snippets.

View blocksector's full-sized avatar

Jay Gauten blocksector

  • Manila, Philippines
View GitHub Profile
package me.kennydude.spending.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.text.Editable;
import android.text.TextPaint;
import android.text.TextWatcher;
@blocksector
blocksector / dynamicslideshow
Created September 4, 2014 02:11
dynamic slideshow script, with featured image changer
(function($, window, document) {
var slideshow = $('.slideshow'),
viewport = $('.thumbs-view', slideshow),
ctrls = $('.ctrl', slideshow),
next_btn = ctrls.filter('.next'),
prev_btn = ctrls.filter('.prev'),
slides_holder = $('.thumbs', slideshow),
slides = $('li', slides_holder),
@blocksector
blocksector / simple-validation.js
Last active December 28, 2015 18:09
jquery validation
var form = $('.application-form'),
requiredFields = $('.required', form),
email_pattern = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/,
key_range = /4[8-9]|5[0-7]|45|32|13/,
topmost_error = $('.application-form-placeholder').offset().top;
has_error = true,
$('#applicant-birthdate').datepicker({
changeMonth: true,
changeYear: true,
@blocksector
blocksector / font-face.scss
Last active December 23, 2015 12:09
sass mixin for embeded fonts.usage@include font-face( [font family name], [font filename] );
@mixin font-face($font-family, $font, $weight : normal, $style : normal) {
@font-face {
font-family: $font-family;
src: url('path/to/font/#{$font}.eot');
src: url('path/to/font/#{$font}.eot?#iefix') format('embedded-opentype'),
url('path/to/font/#{$font}.woff') format('woff'),
url('path/to/font/#{$font}.ttf') format('truetype'),
url('path/to/font/#{$font}.svg##{$font-family}') format('svg');
font-weight: $weight;
@blocksector
blocksector / date-relativetime.js
Last active December 21, 2015 02:59
my snippet to override the default toDateString method of Date object. it should returna date string depending on the format the user passed on.it should follow the date formatting of Django.feature:- customizable date formatsample:var date = new Date();document.write( date.toDateString("l F j Y") );todo:- formatting of date according to user in…
// extend date object and define the format method
Date.prototype.toRelativeTime = function () {
// days of week long string
var day_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
// Month long string
var month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
// the dates