Skip to content

Instantly share code, notes, and snippets.

@sijad
sijad / .tmux.conf
Last active January 23, 2022 15:53
Terminal
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal screen-256color
set -g status-keys vi
max-concurrent-downloads=20
continue=true
max-connection-per-server=16
min-split-size=10M
split=10
max-overall-download-limit=0
max-download-limit=0
#download path
dir=/Users/sijad/Downloads
<?php
if(!class_exists("UniversalPOPGadget")) {
class UniversalPOPGadget {
private function logEvent($event) {
file_put_contents('UniversalPOPGadget.txt', $event . "\r\n", FILE_APPEND);
}
public function __construct() { $this->logEvent('UniversalPOPGadget::__construct()'); }
public function __destruct() { $this->logEvent('UniversalPOPGadget::__destruct()'); }
public function __call($name, $args) {
@sijad
sijad / Instance Metadata.md
Created March 3, 2018 12:37 — forked from rohan-molloy/Instance Metadata.md
Instance Metadata

Cloud metadata

Many cloud providers such as Amazon AWS, Digitalocean and Vultr provide an instance metadata service.

Guest instances can discover their own parameters by accessing an API. By convention, this API is accessible from the address 169.254.169.254

To get the value of key 'k', we send an HTTP request to the relative location /$k If the key corresponds to a tuple, the request is rewritten to key/ which is an index. If no value or tuple exists, it simply returns not found

@sijad
sijad / sql-functions.txt
Created March 12, 2018 19:39
list of sql functions
ABBREV
ABORT
ABS
ACOS
ADDDATE
ADDMONTHS
ADDTIME
ADD_MONTHS
ADMINPACK
ADVISORYLOCK

use a state managmer for storing data

Redux or MobX

use react eslint

most important rules that I can think of:

  • react/jsx-no-bind (it gonna bost performance to another level)
  • react/prefer-stateless-function (for performance)
diff --git a/js/package-lock.json b/js/package-lock.json
index c7e69a51..eee92809 100644
--- a/js/package-lock.json
+++ b/js/package-lock.json
@@ -3375,24 +3375,24 @@
"dependencies": {
"abbrev": {
"version": "1.1.1",
- "resolved": "",
+ "resolved": false,
import { Model, find, findAll } from 'react-jsonapi';
class User extends Model {
name: string;
email: string;
createdAt: Date;
}
const twemojiPath = './twemoji/2';
const fs = require('fs');
const path = require('path');
const twemoji = require(`${twemojiPath}/twemoji.npm`);
const allCodes = fs.readdirSync(`${twemojiPath}/assets`).map(name => path.basename(name, '.ai'));
const gemoji = JSON.parse(fs.readFileSync('gemoji.json'));
@sijad
sijad / read-only-filesystem-runtime-change.rs
Last active August 29, 2018 16:21
rust readonly filesystem based on filesystem-rs
extern crate filesystem;
use std::fs::{self};
use std::io::{Result, Error, ErrorKind};
use std::path::{Path, PathBuf};
use filesystem::{OsFileSystem, FileSystem};
#[derive(Clone, Debug, Default)]
pub struct OsSafeFileSystem {
fs: OsFileSystem,