Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.
Note that you need the https://brew.sh/ package manager installed on your machine.
brew install fish
import { client as Client, connection as Connection } from 'websocket' | |
export interface LogMessage { | |
type: string | |
utf8Data: string | |
} | |
export interface LogMessageContent { | |
level: string | |
data: Data | |
timestamp: number |
def shuffleClass(pupilsList, noToBeMoved): | |
# validate inputs first | |
#check if pupils list is a valid list | |
if not isinstance(pupilsList, list): | |
return [] | |
#check if noToBeMoved is a valid integer | |
if not isinstance(noToBeMoved, int): | |
return pupilsList | |
classSize = len(pupilsList) | |
#if pupils list contains just one element or noToBeMoved is zero return it |
// like parseFloat, but takes an optional radix | |
function parseFloatWithRadix(s, r) { | |
r = (r||10)|0; | |
const [b,a] = ((s||'0') + '.').split('.'); | |
const l1 = parseInt('1'+(a||''), r).toString(r).length; | |
return parseInt(b, r) + | |
parseInt(a||'0', r) / parseInt('1' + Array(l1).join('0'), r); | |
} | |
// like Number..toFixed, but takes an optional radix |
import * as Knex from 'knex'; | |
export async function up(knex: Knex): Promise<any> { | |
return knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => { | |
table.integer('foobar'); | |
}); | |
} | |
export async function down(knex: Knex): Promise<any> { | |
return knex.schema.dropTable('test_setup'); |
// Run this script on this page https://www.worldometers.info/coronavirus/ | |
const c = $$('#main_table_countries_today tr').map(el => ({ | |
country: $(el).find('td:nth-of-type(2)').text(), | |
totalCases: $(el).find('td:nth-of-type(3)').text(), | |
testsPerMillion: $(el).find('td:nth-of-type(13)').text(), | |
tests: $(el).find('td:nth-of-type(12)').text(), | |
})) | |
const toNumber = ({ totalCases, tests, testsPerMillion, country }) => ({ | |
country, |
# Overriding Whitelisted Methods (in my_app/hooks.py) | |
# ------------------------------ | |
override_whitelisted_methods = { | |
"frappe.model.workflow.apply_workflow": "my_app.workflows.apply_workflow" | |
} | |
# in my_app/workflows.py | |
import frappe | |
from frappe.model.workflow import apply_workflow as model_apply_workflow |
/* | |
expo-firestore-persistence-hack | |
A fragile weaving of various modules together to convince the Firestore | |
web SDK to use persistence in an un-ejected Expo app. | |
To use, first: | |
``` | |
$ expo install expo-sqlite |
/* The API | |
================== */ | |
const noop = () => { }; | |
// abstract matcher | |
const match = (field = '', delegate = noop) => { | |
return (data = []) => { | |
return data.filter(entry => delegate(entry[field])); | |
} |
Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.
Note that you need the https://brew.sh/ package manager installed on your machine.
brew install fish
/* | |
JavaScript | |
Write a mySort function which takes in an array integers, and should return an array of the inputed integers sorted such that the odd numbers come first and even numbers come last. | |
For exampl1e: | |
mySort( [90, 45, 66, 'bye', 100.5] ) | |
should return | |
[45, 66, 90, 100] |