Skip to content

Instantly share code, notes, and snippets.

View zGrav's full-sized avatar

David Silva zGrav

View GitHub Profile
@zGrav
zGrav / eventlistener.ts
Created June 17, 2020 09:10
useful event stuff
useEffect(() => {
if (!isSidebarOpen) {
removeAllListeners(document.body, "click");
} else {
addListener(document.body, "click", (event: MouseEvent) =>
handleBodyClick(event, "sidebar", setIsSidebarOpen)
);
}
if (localStorage) {
import { Level1 } from "../elements/depth/shadow";
import { styled, css } from "../../theme/util/helpers";
import { counterstrikeYellowColor } from "../../theme/theme/colors";
import React, { FC } from "react";
interface AvatarContainerProps {
src?: string;
width?: string;
height?: string;
borderRadius?: string;
const keyMirror = (actions: string[]) => {
const mirror: Partial<any> = {};
actions.forEach(action => {
mirror[action] = action;
});
return mirror;
};
@zGrav
zGrav / compare.js
Last active January 24, 2020 11:09
compare
teamData[teamId].sort(function(a, b) {
if (a.kills! < b.kills!) {
return -1;
}
if (a.kills! > b.kills!) {
return 1;
}
return 0;
})
@zGrav
zGrav / gist:2ff9a1640a9b6832e47946627320eaec
Created February 13, 2019 11:00
docker-clean-all reminder
https://github.com/ZZROTDesign/docker-clean
#! /bin/bash
# Don't want to interpret variables whilst reading from the HEREDOC - thus the single quotes... potto
cat << 'EOF' >> /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
document.addEventListener('DOMContentLoaded', function() {
$.ajax({
url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css',
success: function(css) {
$("<style></style>").appendTo('head').html(css);
}
@zGrav
zGrav / debugToConsole.php
Created June 1, 2018 09:16
log php to console
<?php
function debugToConsole($msg) {
echo "<script>console.log(".json_encode($msg).")</script>";
}
debugToConsole('bla');
?>
@zGrav
zGrav / devdocs.json
Created April 24, 2018 08:39
devdocs
{"dark":"1","docs":"css/dom/dom_events/html/http/javascript/angular/angular~4/angular~2/angularjs~1.6/angularjs~1.5/angularjs~1.4/angularjs~1.3/angularjs~1.2/ansible~2.4/apache_http_server/apache_pig~0.17/apache_pig~0.16/apache_pig~0.15/apache_pig~0.14/apache_pig~0.13/async/babel/backbone/bluebird/bootstrap~4/bootstrap~3/bottle~0.12/bottle~0.11/bower/c/cpp/cakephp~3.5/cakephp~3.4/cakephp~3.3/cakephp~3.2/cakephp~3.1/cakephp~2.10/cakephp~2.9/cakephp~2.8/cakephp~2.7/chai/chef~12/chef~11/clojure~1.9/clojure~1.8/clojure~1.7/cmake~3.10/cmake~3.9/cmake~3.8/cmake~3.7/cmake~3.6/cmake~3.5/codeception/codeceptjs/codeigniter~3/coffeescript~2/coffeescript~1/cordova~7/cordova~6/crystal/d/d3~4/d3~3/django~2.0/django~1.11/django~1.10/django~1.9/django~1.8/docker~17/docker~1.13/docker~1.12/docker~1.11/docker~1.10/dojo/drupal~8/drupal~7/electron/elixir~1.6/elixir~1.5/elixir~1.4/elixir~1.3/ember/erlang~20/erlang~19/erlang~18/eslint/express/falcon~1.4/falcon~1.3/falcon~1.2/fish~2.7/fish~2.6/fish~2.5/fish~2.4/fish~2.3/fish~2.2/fl
@zGrav
zGrav / android_pull_apk.sh
Last active April 21, 2018 10:55
backup apk
#!/bin/bash
if [ -z "$1" ]; then
echo "Available packages: "
adb shell pm list packages | sed 's/^package://'
echo "You must pass a package to this function!"
echo "Ex.: android_pull_apk \"com.android.contacts\""
exit 1
fi
@zGrav
zGrav / config
Created March 24, 2018 15:25
Terminator Config CHIP
[global_config]
[keybindings]
[profiles]
[[default]]
palette = "#000000:#E52222:#A6E32D:#FD951E:#C48DFF:#FA2573:#67D9F0:#F2F2F2:#000000:#E52222:#A6E32D:#FC951E:#C48DFF:#FA2573:#67D9F0:#F2F2F2"
[layouts]
[[default]]
[[[child1]]]
type = Terminal
parent = window0