Skip to content

Instantly share code, notes, and snippets.

View saibotsivad's full-sized avatar
💖
JavaScript

Tobias Davis saibotsivad

💖
JavaScript
View GitHub Profile
@saibotsivad
saibotsivad / about.md
Created March 25, 2016 16:54
php admin

I've found this in many compromised PHP boxes.

You can also find it online by searching for the hash.

I want to write up an article about tearing it apart and what we can learn from it.

@saibotsivad
saibotsivad / get-files-or-proxy.conf
Last active April 22, 2016 01:19
Some NGINX conf setups that I've fiddled with.
# all GET requests will serve static files from root
# all !GET requests will get passed to the server running at 4001
server {
listen 80;
server_name site.com;
root /var/www/site.com;
index index.html;
error_page 404 /404.html;
location / {
if ($request_method != GET) {
@saibotsivad
saibotsivad / readme.md
Created August 5, 2016 00:29
notes on docker

docker has different drivers so you do like

docker-machine create --driver=DRIVERNAME MACHINENAME

so like there's an ec2 one that'll spool up ec2 machines with docker

docker run --name nuez-db -e MYSQL_USER=nuez-app -e MYSQL_PASSWORD=nuez+1 -e MYSQL_DATABASE=nuez -e MYSQL_ROOT_PASSWORD=root+1 -p 3306:3306 -d nuez-db

@saibotsivad
saibotsivad / callback.js
Created November 5, 2016 04:26
resolve promise outside of promise
// the basic idea
function connect() {
const map = {}
const connection = makeConnection()
connection.on('data', data => {
const id = parseId(data)
map[id].resolve(data)
})
connection.on('end', () => {
Object.keys(map).forEach(id => map[id].reject('end'))
@saibotsivad
saibotsivad / fixer.js
Created April 24, 2017 19:05
remarkable link fixer
// with inspiration from: https://github.com/vitaliy-bobrov/remarkable-extlink
// for use with: https://github.com/jonschlinkert/remarkable
const md = new Remarkable()
function externalize(mark) {
const linkRegex = /href="([^"]*)"/
const fix = (link = '') => {
if (link.indexOf('http') !== 0) {
return 'http://' + link
@saibotsivad
saibotsivad / Image.html
Created May 9, 2017 14:11
svelte image upload with file reader
<!--
THIS IS A JUNK DRAFT, KEPT FOR A REFERENCE, DON'T USE THIS IDEA
-->
<div class="component-form-field component-form-field-image">
<label for="{{id}}">{{label}}</label>
<input
ref:file
bind:value="file"
on:change="upload(event)"
type="file"
@saibotsivad
saibotsivad / readme.md
Created August 3, 2017 15:10
promise-fun

the idea being a fully modernized version of Sindre's promise-fun package:

  • proper module property in package.json for modern bundlers
  • all the promise modules on their own
  • but a single module 'promise-fun' that just exports those, like d3
  • so now you just add promise-fun as a dependency, but then you use whichever piece you need and don't have the whole thing bloating up your bundle size
  • standardized repo layout for each promise module
  • collect it all together into something for https://www.gitbook.com/
@saibotsivad
saibotsivad / 0-database-data-provider.js
Last active June 12, 2018 13:54
just thinking about how to make a demo that uses a client database
export default mediator => {
mediator.provide('game/get-single', ({ gameId }) => {
return mediator.call('database', `SELECT * FROM game WHERE game.id = ${gameId}`)
})
}
@saibotsivad
saibotsivad / moot-sdk-browser.js
Created October 4, 2017 04:51
browser sdk for the moot app
import fetch from 'whatwg-fetch'
// TODO need to actually use encode/decode on parameters
function generateQueryParameters({ filter, include, fields }) {
const fieldParameters = (fields || [])
.map(field => {
return `fields[${field.name}]=${field.keys.join(',')}`
})
.join('&')
@saibotsivad
saibotsivad / README.md
Last active January 14, 2018 05:47
yavascript dependency manager: a proposal for something crazy

yavascript dependency manager

A proposal for something crazy.


motivation

In this writing I am not going to defend a thesis, I'm going to present a proposal for a system for dependency management in JavaScript.