Skip to content

Instantly share code, notes, and snippets.

View rbecheras's full-sized avatar
👋

Rémi Becheras rbecheras

👋
View GitHub Profile

Purpose

Angular directive code to help resize/redraw non-responsive elements (like D3 charts) in a bootstrap responsive design when the window moves across bootstrap boundaries.

(I edited my boostrap to create an extra size for some 7" tablets and landscape phones @ 600px)

What do you think? Good? Bad? Ugly? How could it be better? What other options exist?

Credit to tagtree for the Rickshaw directive help: http://tagtree.tv/d3-with-rickshaw-and-angular

//
// Bootstrap the jQuery select UX widget using 'Selecter.js' by Ben Plum
// http://www.benplum.com/formstone/selecter/
//
// Dependancies:
// Angular (duh)
// jQuery (required by selecter.js)
// Selecter.js
//
//
@rbecheras
rbecheras / html5-video-streamer.js
Last active August 29, 2015 14:25 — forked from paolorossi/html5-video-streamer.js
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@rbecheras
rbecheras / npm-getting-started.md
Last active August 29, 2015 14:26 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "you@example.com"
npm set init.author.url "http://yourblog.com"

npm adduser

@rbecheras
rbecheras / svg-to-png.js
Created September 22, 2015 22:26 — forked from caged/svg-to-png.js
Convert SVG's to PNGs. This works OK if the SVG's styles are inline. The SVG element must contain an xmlns attribute. Webkit also requires you specify a font size on `text` elements.
var svg = document.getElementById('graph'),
xml = new XMLSerializer().serializeToString(svg),
data = "data:image/svg+xml;base64," + btoa(xml),
img = new Image()
img.setAttribute('src', data)
document.body.appendChild(img)
@rbecheras
rbecheras / svg2png.js
Created September 22, 2015 22:27 — forked from gustavohenke/svg2png.js
SVG to PNG
var svg = document.querySelector( "svg" );
var svgData = new XMLSerializer().serializeToString( svg );
var canvas = document.createElement( "canvas" );
var ctx = canvas.getContext( "2d" );
var img = document.createElement( "img" );
img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) );
img.onload = function() {
@rbecheras
rbecheras / README
Created October 30, 2015 12:53 — forked from emad-elsaid/README
Simple fuzzy search algorithm similar to sublimeText
Simple fuzzy search algorithm similar to sublimeText
this is a simple algorithm to give a similar result
as SublimeText search feature, if you don't use sublimeText
i think you should just give it a shot from here :
http://www.sublimetext.com
to know more about fuzzy search you should check this wiki page:
http://en.wikipedia.org/wiki/Fuzzy_string_searching
@rbecheras
rbecheras / mdxUtil.js
Created February 9, 2016 11:13 — forked from Todd-Werelius/mdxUtil.js
Angular Material Directive to Access Theme Colors
(function() {
angular.module('mdxUtil', ['ngMaterial'])
.directive('mdxPaintFg',function(mdx) {
"use strict";
return {
restrict : 'A',
link : function(scope, element, attributes) {
setRGB(element,'color',mdx.mdxThemeColors,attributes.mdxPaintFg,'mdx-paint-fg');
}
@rbecheras
rbecheras / angularjs-providers-explained.md
Created February 10, 2016 14:29 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@rbecheras
rbecheras / nginxproxy.md
Created April 11, 2016 14:09 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers