Skip to content

Instantly share code, notes, and snippets.

View send2moran's full-sized avatar
🎯
Focusing

Moran Helman send2moran

🎯
Focusing
  • Tel Aviv, Israel
View GitHub Profile
@send2moran
send2moran / gist:525ce6be4210a07228c6
Last active October 4, 2015 19:07
eslintrc airbnb
{
"parser": "babel-eslint",
"plugins": [
"react"
],
"env": {
"browser": true,
"node": true
},
"ecmaFeatures": {
├── app
├── lib
├── components
├── handlers
├── home/
├── components/
├── ...
├── HomeView.jsx
├── styles.less
├── about
@send2moran
send2moran / gist:a41c6c45df7b7b36bc6a
Last active August 29, 2015 14:24
Angular commit messages

Must be one of the following:

  • FEAT: A new feature
  • FIX: A bug fix
  • DOCS: Documentation only changes
  • STYLE: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • REFACTOR: A code change that neither fixes a bug or adds a feature
  • PERF: A code change that improves performance
  • TEST: Adding missing tests
function List() {}
function EmptyList() {}
EmptyList.prototype = new List();
EmptyList.prototype.constructor = EmptyList;
EmptyList.prototype.toString = function() { return '()'; };
EmptyList.prototype.isEmpty = function() { return true; };
EmptyList.prototype.length = function() { return 0; };
EmptyList.prototype.push = function(x) { return new ListNode(x, this); };
@send2moran
send2moran / noncritcss.md
Last active August 28, 2015 18:35 — forked from scottjehl/noncritcss.md
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const port = process.env.HOT_LOAD_PORT || 8888;
const config = {
entry: {
app: [
@send2moran
send2moran / mq_all.css
Created November 5, 2015 10:01 — forked from livercake/mq_all.css
Media Queries
/* Smartphones (portrait & landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
#EXTM3U
#EXTINF:0,Sport 1HD
http://46.28.50.124:8088/stream/lpdfofd/playlist.m3u8?id=2262&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
#EXTINF:0,Sport 2HD
http://46.28.53.22:8088/stream/mchnfa/playlist.m3u8?id=2357&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
#EXTINF:0,Sport 5HD Live
http://46.28.53.30:8088/stream/ergerg123/playlist.m3u8?id=1976&pk=b33dd8b05f95e1a51c19723f2414bdaab7686f7aa24702533f59f93649b02d17
if(window.safari) {
// YOUTUBE HACKS for ClickToPlugin
var script = "var s = document.createElement('script'); s.textContent = 'if(!/[?&]html5=1/.test(location.search)){";
// Disable SPF
script += "ytspf={};Object.defineProperty(ytspf,\"enabled\",{\"value\":false});";
// Disable HTML5
script += "HTMLMediaElement.prototype.canPlayType=function(){return\"\";};HTMLMediaElement.prototype.nativePlay=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){if(this.className===\"CTPmediaElement\")this.nativePlay();else{this.removeAttribute(\"src\");this.load();}};";
// Disable Flash version checking...
// ... on /watch pages
script += "ytplayer={};Object.defineProperty(ytplayer,\"config\",{\"get\":function(){return ytplayer.$;},\"set\":function($){$.min_version=\"0.0.0\";$.url_v9as2=$.url;ytplayer.$=$;}});";
if(window.safari) {
// YOUTUBE HACKS for ClickToPlugin
var script = "var s = document.createElement('script'); s.textContent = 'if(!/[?&]html5=1/.test(location.search)){";
// Disable SPF
script += "ytspf={};Object.defineProperty(ytspf,\"enabled\",{\"value\":false});";
// Disable HTML5
script += "HTMLMediaElement.prototype.canPlayType=function(){return\"\";};HTMLMediaElement.prototype.nativePlay=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){if(this.className===\"CTPmediaElement\")this.nativePlay();else{this.removeAttribute(\"src\");this.load();}};";
// Disable Flash version checking...
// ... on /watch pages
script += "ytplayer={};Object.defineProperty(ytplayer,\"config\",{\"get\":function(){return ytplayer.$;},\"set\":function($){$.min_version=\"0.0.0\";$.url_v9as2=$.url;ytplayer.$=$;}});";