Skip to content

Instantly share code, notes, and snippets.

View ameyms's full-sized avatar

Amey Sakhadeo ameyms

View GitHub Profile
@ameyms
ameyms / Gruntfile.js
Created May 4, 2013 11:02
Possible 'correct' implementation of handlebars in yeoman+grunt. Not sure.
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
@ameyms
ameyms / go-github-client.go
Created October 24, 2013 17:15
Alternative go-github API
func main() {
watchers, pager, _, err := client.Activity.ListWatchers("o", "r")
if pager.HasNext() {
watchers, pager, _, err = pager.Next()
}
//..
//or:
watchers, pager, _, err = pager.Last()
}
@ameyms
ameyms / README.md
Last active August 29, 2015 13:56
Line Chart using d3.svg.brush

A D3 line chart demonstrating d3.svg.brush() for zooming capabilities à la Google Finance

@ameyms
ameyms / README.md
Created February 22, 2014 08:41
D3 Gauge

A simple gauge chart using d3 Inspired by Jake Trent's Codepen snippet

To move the pointer needle, type in following code in you javascript console

needle.moveTo(.25)
@ameyms
ameyms / README.md
Last active September 15, 2021 11:28
D3 Gauge - Part Deux

Yet another simple gauge chart using d3 Inspired by Jake Trent's Codepen snippet

To move the pointer needle, type in following code in you javascript console

needle.moveTo(.25)
@ameyms
ameyms / dom_manip_ctrl.js
Created August 15, 2014 14:56
Angular Blasphemy
angular.module('myApp').controller( function ( $scope ) {
var foo = $('button.foo'),
bar = $('input[data-role="bar"]'),
baz = $('div.status'),
flag = true;
foo.click( function () {
if ( flag ) {
bar.hide();
baz.addClass( 'done' );
}
@ameyms
ameyms / final_goal.md
Created August 15, 2014 15:30
Lost in $translate
@ameyms
ameyms / apply_plugin.js
Created January 26, 2015 23:03
A directive and provider pair to apply arbitrary JQuery plugins to elements
angular.module( 'ameyms.jqplugin' ).
directive( 'applyPlugin', [ 'jqueryPlugins', function ( jqPlugins ) {
var postLinkFn;
postLinkFn = function ( scope, elem, attrs ) {
var currPlugin = attrs.applyPlugin,
opts = jqueryPlugins.getOptionsFor( currPlugin );
// Apply plugin
$( elem )[ currPlugin ]( opts );
@ameyms
ameyms / cloud.js
Last active July 25, 2017 17:36 — forked from blockspring/cloud.js
D3 Wordcloud
// Word cloud layout by Jason Davies, http://www.jasondavies.com/word-cloud/
// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf
(function() {
function cloud() {
var size = [256, 256],
text = cloudText,
font = cloudFont,
fontSize = cloudFontSize,
fontStyle = cloudFontNormal,
fontWeight = cloudFontNormal,
@ameyms
ameyms / dabblet.css
Created November 19, 2017 20:41
Ratings Stars
/*
Ratings Stars
(with as little code as possible)
*/
.rating {
unicode-bidi: bidi-override;
direction: rtl;
text-align: center;
}
.rating > span {