Skip to content

Instantly share code, notes, and snippets.

@tttimur
tttimur / gist.js
Created August 22, 2017 00:12
nano comp test
var Nanocomponent = require('nanocomponent')
var html = require('choo/html')
class FeaturedPost extends Nanocomponent {
constructor () {
super()
this.post = null
this.emit = null
}
@tttimur
tttimur / header.js
Last active August 26, 2017 00:33
index.js
var Nanocomponent = require('nanocomponent')
var html = require('choo/html')
class Header extends Nanocomponent {
constructor () {
super ()
this.state = null
this.emit = null
}
@tttimur
tttimur / image-optim.sh
Last active May 21, 2021 15:33
Image optimization with mozjpeg and webp
# this is not a bash file to execute, but run the following commands in your terminal
# requirements (install instructions at bottom of page)
# imagemin-cli, imagemin-mozjpeg, imagemin-pngquant, imagemin-webp, imagemagick (mogrify)
--------------------------------------------------------------
# 1. create the appropriate directories
$ mkdir build large large-webp small small-webp
# 2. mozjpeg compression of fullsize images
$ imagemin *.jpg --out-dir=build --plugin=mozjpeg && imagemin *.png --out-dir=build --plugin=pngquant
{
"bold_folder_labels": true,
"caret_extra_bottom": 0,
"caret_extra_top": 0,
"caret_extra_width": 0,
"caret_style": "blink",
"color_scheme": "Packages/Boxy Theme/schemes/Boxy Ocean.tmTheme",
"drag_text": true,
"fade_fold_buttons": true,
"font_face": "Source Code Pro",
@tttimur
tttimur / util.css
Last active February 22, 2018 20:40
gr9
/*!
* small changes on the base of gr8.
* to me it seems easier to edit this css file than create a gr8 browserify env
* gr8.css • v3.1.3
* github.com/jongacnik/gr8
*/
.c{top:50%;left:50%;transform:translate(-50%, -50%)}
.cy{top:50%;transform:translateY(-50%)}
.cx{left:50%;transform: translateX(-50%)}
// responsive support and webp support
return `
<picture>
<source media="(max-width: 799px)" srcset="assets/images/small-webp/${name}.webp" type="image/webp" />
<source media="(min-width: 800px)" srcset="assets/images/large-webp/${name}.webp" type="image/webp" />
<source media="(max-width: 799px)" srcset="assets/images/small/${name}.jpg" type="image/jpeg" />
<source media="(min-width: 800px)" srcset="assets/images/large/${name}.jpg" type="image/jpeg" />
<img class="c12 h100" src="assets/images/large/${name}.jpg" alt="img" />
</picture>
const gr8 = require('gr8')
const recsst = require('recsst')
const lilcss = require('lilcss')
const colors = {
white: '#fff',
black: '#000',
grey: '#ccc'
}
@tttimur
tttimur / searx-localinstall.md
Created January 15, 2019 19:14
How to setup searx locally without docker to edit the webapp for theming

Closed, but wanted to mention how I got this to work

  1. Make sure you have python 2 installed
  2. Open file ./manage.sh and edit line 21 pip install --user "$BASE_DIR/requirements.txt" to include --user flag
  3. Run command in your cli ./manage.sh update_packages to install all the dependencies
  4. Open file ./searx/settings.yml and changed debug: True in general
  5. Install Flask
  6. cd searx && export FLASK_APP=webapp.py && flask run
@tttimur
tttimur / cms.js
Last active May 20, 2019 19:15
4ye collections
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
Step 1
--
Create new user
Step 2
--
Add user to mysql
`CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';`
`GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';`
`FLUSH PRIVILEGES;`