Skip to content

Instantly share code, notes, and snippets.

View shprink's full-sized avatar
🏠
Working from home

Julien Renaux shprink

🏠
Working from home
View GitHub Profile
.directive('headerShrink', function($document) {
return {
restrict: 'A',
link: function($scope, $element, $attr) {
var y = 0,
prevY = 0,
scrollDelay = 0.4,
scrollTop,
fadeAmt;
var this.options = {
count: 3,
from: -60,
to: 60
};
var from = Math.max(-90, Math.min(90, +this.options.from));
var to = Math.max(-90, Math.min(90, +this.options.to));
var rotateScale = d3.scale.linear().domain([0, this.options.count - 1]).range([from, to]);
// http://www.geonames.org/BD/largest-cities-in-bangladesh.html
var cities = []; [].forEach.call(document.querySelectorAll('table.restable a:not([rel=nofollow])'), function(el){console.log(el.innerText); if (el.innerText) cities.push(el.innerText)}); console.log(cities.join(','))
var js = [variables.bower + 'd3/d3.js',
variables.bower + 'd3-tip/index.js',
variables.bower + 'd3-cloud/d3.layout.cloud.js',
variables.bower + 'c3/c3.js',
variables.bower + 'topojson/topojson.js',
variables.bower + 'datamaps/dist/datamaps.all.js',
variables.bower + 'moment/moment.js',
variables.bower + 'moment/locale/en-gb.js',
variables.bower + 'moment/locale/fr.js',
variables.bower + 'moment/locale/es.js',
var gulp = require('gulp'),
runSequence = require('run-sequence'),
gulpif = require('gulp-if'),
argv = require('minimist')(process.argv.slice(2)),
uglify = require('gulp-uglify'),
clean = require('gulp-clean'),
minifyCss = require("gulp-minify-css"),
minifyHtml = require("gulp-minify-html"),
header = require("gulp-header"),
stripDebug = require('gulp-strip-debug'),
@shprink
shprink / Ionic, scope CSS by state
Created February 16, 2016 16:42
Allow modifying any element by state and avoid CSS leaking
// JS
$rootScope.$on('$stateChangeSuccess', (event, toState, toParams, fromState, fromParams) => {
// Add a timeout for ionic transitions
// For 500ms we will have both module classes
// so both modules will have the right css
// when transitionned we remove the previous module class
clearTimeout(stateChangeTimeout);
stateChangeTimeout = setTimeout(() => {
$document.find('html').removeClass(`${_.kebabCase(fromState.class || fromState.name)}`);
}, 500);
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > ~/Downloads/test.png
import React, { Component } from 'react';
import { format } from "d3-format";
import { timeFormat } from "d3-time-format";
import ReStock from "react-stockcharts";
const { ChartCanvas, Chart, series, scale, coordinates, tooltip, axes, helper } = ReStock;
const { LineSeries, AreaSeries, ScatterSeries, CircleMarker } = series;
const { discontinuousTimeScaleProvider } = scale;