Skip to content

Instantly share code, notes, and snippets.

View dgieselaar's full-sized avatar

Dario Gieselaar dgieselaar

View GitHub Profile
$icons: (
"access-point": F002,
"access-point-network": F003,
"account": F004,
"account-alert": F005,
"account-box": F006,
"account-box-outline": F007,
"account-card-details": F5D2,
"account-check": F008,
"account-circle": F009,
{
"errors": [
],
"warnings": [
],
"version": "1.12.2",
"hash": "943a89361ef0d15cc5b6",
"publicPath": "/assets/",
#!/bin/sh
changed_files="$(git diff --name-only --cached)"
check_run() {
echo "$changed_files" | grep -q '\.js$' && eval "$1"
}
check_run "npm run-script lint"
let ctrl = this,
listResource = resource(( ) => `/api/list/${ctrl.listId()}`, { scope: $scope }),
followedByUserResource = resource( ( ) => `/api/user/following`, { scope: $scope }),
listUsersReducer =
composedReducer(listResource, followedByUserResource, ( ) => ctrl.query)
.reduce(( list, followed, query ) => {
return list.users.filter(
user => user.username.includes(query);
)
let ctrl = this,
followers = resource('/api/user/followers', { scope: $scope });
followers.reduce( ( requestOptions, data ) => data.filter(follower => follower.followed_by_user));
ctrl.getFollowing = ( ) => followers.data();
let ctrl = this,
listType = 'following',
listItems,
state;
let fetchData = ( ) => {
state = 'pending';
$http({
url: `/api/user/list/${listType}`
})
var listeners = [],
$window;
beforeEach(function ( ) {
var fn;
if(!$window) {
$window = angular.injector([ 'ng' ]).get('$window');
@dgieselaar
dgieselaar / gist:3377aa5c2223098e8622
Created June 23, 2015 14:17
Hide videos which have under a 1000 views from a youtube channel's video list
Array.prototype.slice.call(document.querySelectorAll('.yt-lockup-meta-info > li:first-child')).forEach(function ( el ) {
var views = Number(el.textContent.match(/(\d+,?\d+)/)[0].replace(',','')),
parent;
if(views < 1000) {
parent = el.parentNode;
while(!parent.classList.contains('channels-content-item')) {
parent = parent.parentNode;
}
parent.parentNode.removeChild(parent);
I'm using webpack to compile my application source. It splits up the files in chunks which are lazily loaded when necessary. However, the sourcemaps for the first file (main.js) breaks if the second file (2.js) is loaded in.
Here's when it _does_ work.
- if I throw an error in main.js immediately instead of with a timeout
- if 2.js is not lazily-loaded but available in a script tag when the page is rendered
Here's what I've tried to make it work
- remove the sourcemap for 2.js
- remove the content of 2.js
@dgieselaar
dgieselaar / gist:8b20e9d593e1806a098b
Last active July 5, 2017 10:39
Code splitting, lazy-loading, import statements, Angular + newNgRouter + ocLazyLoad + webpack
import _ from 'lodash';
import angular from 'angular';
import 'angular-new-router';
import 'oclazyload';
function AppController ( ) {
}
AppController.$routeConfig = [];