Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Kiko Beats Kikobeats

🎯
Focusing
View GitHub Profile
@Kikobeats
Kikobeats / index.js
Created Jul 10, 2018
Microlink API connector
View index.js
'use strict'
const microlink = require('microlink-api')
const url = 'https://google.com'
const doRequest = microlink.createRule($ => {
// do whatever you want here
return {
title: $('h1'),
@Kikobeats
Kikobeats / gist:7ac68289bfca7494bc47fd975678da2d
Created Jun 5, 2018
npm ERR! asyncWrite is not a function at node@10.3.0 and npm@6.1.0
View gist:7ac68289bfca7494bc47fd975678da2d
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'i' ]
2 info using npm@6.1.0
3 info using node@v10.3.0
4 verbose npm-session ce449290ed10022f
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall microlink-www@1.1.0
7 info lifecycle microlink-www@1.1.0~preinstall: microlink-www@1.1.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
@Kikobeats
Kikobeats / index.js
Created May 10, 2018
Microlink API custom rules integration
View index.js
'use strict'
const microlinkAPI = require('microlink-api')('YOUR_API_KEY')
;(async() => {
const url = 'https://google.com'
const opts = {
prerender: false,
// You can extend the current rules or add more!
@Kikobeats
Kikobeats / Hide.js
Last active Feb 26, 2020
Hide + rebass
View Hide.js
import styled from 'styled-components'
import { theme } from 'rebass'
const { breakpoints } = theme
const lastIndex = breakpoints.length - 1
const getMediaBreakpoint = (breakpoints, breakpoint, index) => {
if (index === 0) return `@media screen and (max-width: ${breakpoint})`
const prevBreakpoint = breakpoints[index - 1]
if (index === lastIndex) {
@Kikobeats
Kikobeats / sitemap.xml
Last active Jun 29, 2019
Example Sitemap
View sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.90">
<url>
<loc>http://www.sitemappro.com/</loc>
<lastmod>2018-01-27T23:55:42+01:00</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://www.sitemappro.com/download.html</loc>
View download_node.sh
#!/bin/bash
NODE_BIN=`curl -sL https://semver.io/node/resolve/8`-linux-x64
echo "Downloading $NODE_BIN binary file"
curl -sL https://nodejs.org/dist/latest-v8.x/node-v$NODE_BIN.tar.gz | tar -xz
mkdir -p bin
mv node-v$NODE_BIN/bin/node bin/node
rm -rf node-v$NODE_BIN
@Kikobeats
Kikobeats / README.md
Last active Dec 18, 2017
Favorite CLI programs
View README.md
@Kikobeats
Kikobeats / webpack.config.js
Last active Feb 22, 2017
autotrack + webpack
View webpack.config.js
'use strict'
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')
const PurifyCSSWebpackPlugin = require('purifycss-webpack-plugin')
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const PreloadWebpackPlugin = require('preload-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const OfflinePlugin = require('offline-plugin')
const webpack = require('webpack')
View encode.js
var utf8 = require('utf8');
var val1 = utf8.decode('\xE2\x80\x99');
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
const symbol = new Buffer([0xE2, 0x80, 0x99]);
const val2 = decoder.write(symbol);
console.log(val1);
View bench.js
'use strict'
const _simpleArrayDiff = require('simple-array-diff')
const { map, range, random } = require('lodash')
const suite = require('fastbench')
const _hyperDiff = require('.')
const _range = range(0, 1000)
function generateRange (_range) {
return map(_range, () => { return { id: random(0, 100) } })
}