Skip to content

Instantly share code, notes, and snippets.

View uzaif313's full-sized avatar
🎯
Focusing

Uzaif uzaif313

🎯
Focusing
View GitHub Profile

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@uzaif313
uzaif313 / snippet.md
Created August 10, 2021 10:27
cool snippet
const CSVToArray = (data, delimiter = ',', omitFirstRow = false) =>
  data
    .slice(omitFirstRow ? data.indexOf('\n') + 1 : 0)
    .split('\n')
    .map(v => v.split(delimiter));
@uzaif313
uzaif313 / cable_debug.html
Last active July 28, 2020 09:41
debug action cable
<html>
<head>
<script src="https://raw.githubusercontent.com/rails/rails/master/actioncable/app/assets/javascripts/action_cable.js"></script>
<script type="text/javascript">
var cachedHost, i, message_types, protocols, ref, supportedProtocols, unsupportedProtocol,
slice = [].slice,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
cachedHost = localStorage.getItem('_host');
@uzaif313
uzaif313 / routin.md
Last active December 9, 2021 06:57
useful stuff

Kill Rails server

kill -9 $(lsof -t -i:3000)

Restore table in postgresql database

pg_restore -h <hostname> -U <username> --data-only -d <dbname> -t <table_name> <path/of/backupfile>

Login to psql console

@uzaif313
uzaif313 / heroku-command
Last active October 11, 2019 10:11
heroku command
heroku pg:backups:capture
heroku pg:backups:download
# connect to local machine
heroku pg:credentials:url
# database.yml
development:
adapter: postgresql
@uzaif313
uzaif313 / vs-code-config
Last active September 19, 2019 11:07
Basic vscode config with react and jsx
{
"explorer.confirmDelete": false,
"editor.formatOnSave": true,
"[ruby]": {
"editor.formatOnSave": true
},
"ruby.format": "rubocop",
"javascript.format.enable": false,
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
@uzaif313
uzaif313 / javascript_deep_dive.md
Created June 18, 2019 07:40 — forked from faressoft/javascript_deep_dive.md
JavaScript Deep Dive to Crack The JavaScript Interviews

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
class Hash
def nested_each_pair
self.each_pair do |k,v|
if v.is_a?(Hash)
v.nested_each_pair {|k,v| yield k,v}
else
yield(k,v)
end
end
@uzaif313
uzaif313 / block_yield.rb
Created January 3, 2019 02:53
random block stuff
## secret of yield
def keep_calme_and_write_block
puts "Starting Method at #{Time.now}"
yield
puts "Ending Method at #{Time.now}"
end
keep_calme_and_write_block do