Skip to content

Instantly share code, notes, and snippets.

View loopmode's full-sized avatar

Jovica Aleksic loopmode

  • ETECTURE
  • Fulda, Frankfurt
View GitHub Profile
@loopmode
loopmode / videolist.php
Last active August 29, 2015 14:04
PHP cached json from multiple files
<?php
/**
* Serves a JSON array with the contents of multiple JSON files.
*
* Scans a $path for $target JSON files in nested folders,
* collects the contents of each of those files and outputs
* them as a JSON array.
* ($path/{*dir}/$target)
*
@loopmode
loopmode / gist:125201a540a66f8e5e87
Created August 6, 2014 12:58
Simple MVC, jQuery/Underscore
(function($, _) {
if (!Function.prototype.bind) Function.prototype.bind = function(scope) { return $.proxy(this, scope); };
if (!window.console) { window.console = {log : $.noop, warn: $.noop, error : $.noop}; }
_.templateSettings = { interpolate: /\{\{(.+?)\}\}/g };
$(document).ready(function() {
window.portfolio = new PortfolioController();
@loopmode
loopmode / jsbeautifier-es6-hacks
Last active July 12, 2016 13:25
Some (ugly!) hacks to fix es6/es7 formatting problems in jsbeautifier. I use it with the "html/css/js prettify" plugin for Sublime Text
// in Sublime Text, Preferences -> Browse Packages, find HTML-CSS-JS Prettify/scripts/node_modules/js-beautify/js/lib/beautify.js
// find the last line of the 'beautify' function, and place the next lines just before 'return sweet_code';
// https://gist.github.com/loopmode/d091bce3b76efaf15d63
// es7 decorators
sweet_code = sweet_code.replace(/@\n/g, '@');
sweet_code = sweet_code.replace(/\)@\s/g, ')\n@');
sweet_code = sweet_code.replace(/ @ /g, ' @');
sweet_code = sweet_code.replace(/@\s/g, '\n@');
sweet_code = sweet_code.replace(/\];@/g, '];\n@');
@loopmode
loopmode / .eslintrc
Last active August 29, 2015 14:26
react webpack babel starter
{
"parser": "babel-eslint",
"env": {
"browser": true,
"node": true
},
"plugins": [
"react"
],
"ecmaFeatures": {
@loopmode
loopmode / .bashrc
Created July 28, 2015 20:46
rmdeep.bat - fast deep delete, e.g. for node_modules. add to system path
rmdeep() {
cmd //c rmdeep.bat $1;
}
@loopmode
loopmode / gist:0634572aed8ef9fe963a8e54634f454f
Created April 17, 2016 09:32
nisv webpack compiler stats
>> 0.00%, compile
>> 10.00%, 0/1 build modules
>> 70.00%, 1/1 build modules
>> 71.00%, seal
>> 73.00%, optimize
>> 75.00%, hashing
>> 76.00%, create chunk assets
>> 78.00%, additional chunk assets
>> 80.00%, optimize chunk assets
>> 90.00%, optimize assets
# audio waveformss
## situation
- we use audiosurfer.js, which renders the waveform on the client
- currently, v1 does not support media fragment URI queries like `?t=10,15` and we must fall back to `#t=10,15`
- this means that the data for the entire audio file must be transferred to and processed on the client
## SOLUTIONS
// https://medium.com/@sheepsteak/adding-hot-module-reloading-to-create-react-app-e053fadf569d#.2q2q1mvxs
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
const rootEl = document.getElementById('root');
ReactDOM.render(
<App />,
rootEl
);
[
{ "keys": ["ctrl+y"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }
]
@loopmode
loopmode / connect.js
Last active May 22, 2017 07:35
A HOC decorator for binding react components to alt.js immutable stores
import connectToStores from 'alt-utils/lib/connectToStores';
/* eslint-disable */
/**
* A component decorator for connecting to immutable stores.
*
* Basically a wrapper around `alt/utils/connectToStores`.
* Adds the necessary static methods `getStores()` and `getPropsFromStores()` to the decorated component.
*
* - Supports multiple stores.