Skip to content

Instantly share code, notes, and snippets.

View fanyer's full-sized avatar

Fy fanyer

  • Somewhere on Earth
View GitHub Profile
@fanyer
fanyer / shell-out.ps1
Created March 3, 2023 08:01 — forked from kreig303/shell-out.ps1
Powershell aliases for git and npm
##
# POWERSHELL SPECIFIC
##
Set-Alias clr clear # slight contraction of clear command
function brc { Start notepad "C:\Users\kzimmerman012\Documents\PowerShell\profile.ps1" } # for editing this file
function Reload-PowerShell { Start-Process pwsh; exit } # reload PowerShell Core
Set-Alias relo Reload-PowerShell
function lw { dir | fw } # wide listing
function up { cd .. } # better back
function rmraf { Remove-Item -Recurse -Force $args[0] }
@fanyer
fanyer / downloadjsonascsv.js
Created February 13, 2023 11:44 — forked from royashbrook/downloadjsonascsv.js
Button Handler to download some JSON as CSV
//bind onclick to downloadcsv.
//o should be the json you want to turn into a table
//h should be a string array for the header row, or this can be null and it will use the keys from the first record
//n is the name of the file, csv will be appended. if omitted it will just be 'data.csv'
export const downloadcsv = (o,h,n = 'data') => {
downloadFile( toCSV(o,h) , n + '.csv', 'text/csv' );
}
const toCSV = (o,h) => {
const a = (v) => `"${v.join(`","`)}"`
let csv = []
@fanyer
fanyer / get-script-promise.js
Created February 2, 2023 02:53 — forked from james2doyle/get-script-promise.js
Async load a script in the page and run it. Uses promises
// this function will work cross-browser for loading scripts asynchronously
function loadScript(src) {
return new Promise(function(resolve, reject) {
const s = document.createElement('script');
let r = false;
s.type = 'text/javascript';
s.src = src;
s.async = true;
s.onerror = function(err) {
reject(err, s);
@fanyer
fanyer / .vimrc
Created July 20, 2022 02:07 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@fanyer
fanyer / .block
Created January 19, 2020 03:43 — forked from kerryrodden/.block
Sequences sunburst (d3 v4)
license: apache-2.0
@fanyer
fanyer / build.gradle
Created May 14, 2019 13:52 — forked from TurekBot/build.gradle
Gradle Shadow Example
group 'com.github.yourusername'
version '1.0-SNAPSHOT'
//These are dependencies that have to do with just the build. See: https://stackoverflow.com/a/23627293/5432315
buildscript {
repositories {
jcenter()
}
dependencies {
//This is necessary to use the gradle shadow plugin
@fanyer
fanyer / sms.py
Created October 4, 2018 12:28 — forked from lihongjie0209/sms.py
from androidhelper import Android
from time import sleep
import json
import urllib2
d = Android()
url = "youserver/sms/notify"
while(True):
messages = d.smsGetMessages(False)
for i in messages.result:
@fanyer
fanyer / EventSystem.js
Created July 26, 2018 09:10 — forked from simonberger/EventSystem.js
Global event system for React.js
class EventSystem {
constructor() {
this.queue = {};
}
publish(event, data) {
let queue = this.queue[event];
if (typeof queue === 'undefined') {
return false;
@fanyer
fanyer / eslint-pushed-changes.sh
Created July 20, 2018 08:12 — forked from stalniy/eslint-pushed-changes.sh
ESLINT + pre-receive git hook
#!/bin/bash
TEMPDIR=`mktemp -d`
ESLINTRC=$TEMPDIR/.eslintrc
COMMAND="eslint --color -c $ESLINTRC --rule 'import/no-unresolved: 0' --rule 'import/no-duplicates: 0' --rule 'import/export: 0'"
git show HEAD:.eslintrc > $ESLINTRC
echo "### Ensure changes follow our code style... ####"
# See https://www.kernel.org/pub/software/scm/git/docs/githooks.html#pre-receive
@fanyer
fanyer / tmux.conf
Created June 21, 2018 08:45 — forked from yilenpan/tmux.conf
tmux
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# prefix key to backtick (`)
# unbind C-b
# set-option -g prefix `
# So we can still use ` when needed (prefix + )