Skip to content

Instantly share code, notes, and snippets.

@minipai
minipai / queryString.js
Created September 11, 2020 13:10
query-string native replacement
const SearchParams = {
parse(queryString) {
return Object.fromEntries(new URLSearchParams(queryString).entries())
},
stringify(query) {
return new URLSearchParams(query).toString()
}
}
@minipai
minipai / jsconfig.json
Last active January 9, 2019 11:26
jsconfig.json for Stackla web
{
"compilerOptions": {
"target": "es2018",
"jsx": "react",
"baseUrl": "./app/media/",
"paths": {
"admin/*": [
"js/admin/*"
],
"common/*": [
@minipai
minipai / index.html
Created November 15, 2012 00:38
A CodePen by Art Pai. CSS Chrome-like tab
<div class="tabs">
<div class="tab"><div class="tab-box"></div></div>
<div class="tab"><div class="tab-box"></div></div>
<div class="tab active"><div class="tab-box"></div></div>
<div class="tab"><div class="tab-box"></div></div>
</div>
<div class="content">
</div>
@minipai
minipai / gist:3150020
Created July 20, 2012 10:18
Middleman 3 Template Layouts
title
Layouts &amp; Partials

Layouts

Layouts allow the common HTML surrounding individual pages to be shared across all your templates. The most basic layout has some shared content and a yield call where templates will place their contents. Furthermore, With wrap_layout, content_for and partial you can build a complex layout inheritance, reduce the duplication of you code in templates to a minimal amount.

Basic layout

@minipai
minipai / json
Created February 15, 2018 20:17
jsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "ES6",
"baseUrl": "./",
"paths": {
"~/*": ["./*"]
}
},
"exclude": [
@minipai
minipai / plugin.js
Created October 24, 2016 23:38
babe plugin add Component name on div
module.exports = function (babel) {
var t = babel.types;
var visitor = {
ClassDeclaration: function(code) {
var node = code.node;
var className = node.id.name;
var renderMethod;
for (i=0; i<code.node.body.body.length; i++) {
var method = code.node.body.body[i];
@minipai
minipai / AngularWay
Last active December 19, 2015 13:29
Refactor from Backbone to Angular.
window.commentsCtrl = ($http, $scope, $element)->
update = ()->
$http.get(location.pathname).success (result)->
$scope.comments = result.comments
update()
e$form = $element.find('form')
e$form.submit (e)->
e.preventDefault()
$.post(e$form.attr('action'), e$form.serialize(), ()->
@minipai
minipai / sample.md
Last active December 17, 2015 06:59

HTML A

<div class="box">
    <div class="box-title"></div>
    <div class="box-content"></div>
</div>

CSS A

 .box {...}
@minipai
minipai / styleguide.jsx
Created March 4, 2015 10:10
Use ReactJS to create style guide
var React = require('react');
var beautify = require('js-beautify').html
var StyleBlock = React.createClass({
render: function () {
var Element = this.props.element
return (
@minipai
minipai / gist:4161973
Created November 28, 2012 15:28
sublime-settings
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"draw_white_space": "all",
"file_exclude_patterns":
[
"*.pyc",
".DS_Store"
],
"folder_exclude_patterns":
[