Skip to content

Instantly share code, notes, and snippets.

View daniellizik's full-sized avatar

Daniel Lizik daniellizik

  • Tablecheck
  • Tokyo, JP
View GitHub Profile
@daniellizik
daniellizik / Preferences.sublime-settings
Last active January 29, 2016 05:16
sublime settings
{
"color_scheme": "Packages/Colorsublime-Themes/Solarized (dark).tmTheme",
"font_size": 11,
"ignored_packages":
[
"Vintage"
],
"margin": -5
}
@daniellizik
daniellizik / style.md
Last active February 7, 2016 03:09
angular naming styles

#structure

/global
/components

global holds components shared by other components, components are privately scoped components.

#structure per component

/foobar

(function(name, global, factory) {
//amd
if (typeof global.define === 'function' && global.define.amd)
global.define([], function() { return factory; });
//common js
else if (typeof global.module === 'object' && global.module.exports) {
global.module.exports = factory;
@daniellizik
daniellizik / webpack.config.development.js
Created April 21, 2016 04:06
express, angular 1x, webpack, HMR, webpack dev middleware, stylus loading
var path = require('path'),
webpack = require('webpack'),
packageJson = require('./package.json');
module.exports = {
devtool: 'eval',
context: __dirname,
@daniellizik
daniellizik / log.js
Created April 22, 2016 16:04
colorful logging in chrome
(function(root, name, factory) {
root[name] = factory();
})(this, 'Log', function() {
'use strict';
/**
* @constructor Log
* logs pretty, easy
*
* @param {string} - message to log
@daniellizik
daniellizik / constants.yml
Last active April 24, 2016 18:48
webpack, postcss (import, map, nested, lost, autoprefix), hmr, middleware, express
breakpoints:
mobile:
max: "600px"
tablet:
min: "601px"
max: "1000px"
desktop:
min: "1001px"
@daniellizik
daniellizik / deepsearch-find-first.js
Last active May 22, 2016 03:02
needle/haystack deep search, searches for value if it matches a key and will stop execution once found.
'use strict';
function deepsearch_find_first(needle, haystack, parent) {
let iterable;
if (Object.prototype.toString.call(haystack) === '[object Array]') {
iterable = haystack;
} else if (Object.prototype.toString.call(haystack) === '[object Object]') {
iterable = Object.keys(haystack);
@daniellizik
daniellizik / deepsearch-get-keys.js
Last active May 17, 2016 03:10
deep search key accumulate
function deepsearch_get_keys(haystack, bucket = []) {
let i = 0;
let p;
if (Object.prototype.toString.call(haystack) === '[object Array]') {
for (i; i < haystack.length; i++)
ds(haystack[i], bucket);
}
@daniellizik
daniellizik / deepsearch-pull-matches.js
Last active May 17, 2016 03:10
deep search, pull all matches
function deepsearch_pull_matches(needle, haystack, parent, bucket = []) {
let i = 0;
let p;
let found;
if (Object.prototype.toString.call(haystack) === '[object Array]') {
for (i; i < haystack.length; i++) {
found = ds(needle, haystack[i], haystack, bucket);
if (found !== undefined && found !== bucket)
@daniellizik
daniellizik / deepsearch-find-first-make-path.js
Created May 17, 2016 03:54
deepsearch find first, make path
function deepsearch_find_first_make_path(needle, haystack, delimiter = '.', path = []) {
let i = 0;
let p;
let found;
if (Object.prototype.toString.call(haystack) === '[object Array]') {
for (i; i < haystack.length; i++) {
found = deepsearch_find_first_make_path(needle, haystack[i], delimiter, path.concat(i));
if (found && found !== path) {