r/backtickbot • • May 16 '21

https://np.reddit.com/r/reactjs/comments/ndkdx2/reduce_redundancy_in_handling_change/gyb5biq/

0 Upvotes

You can modify handleChange to take the setState function as its parameter that will then return another function to call the setState:

const handleChange = (setState) => {

  return ({ target: { value }) => {
    setState((oldState) => ({ ...oldState, value })
  }  
};

You then use the above function like:

<TextInput
    invalid={username.invalid}
    invalidText={username.invalidText}
    name="userName"
    onChange={handleChange(setUsername)}
    onBlur={handleInput}
    value={username.value}
/>

Hope that helps !


r/backtickbot • • Feb 27 '21

https://np.reddit.com/r/node/comments/lte28q/how_can_i_improve_multiple_returns_new_promise/goxvdbv/

0 Upvotes

Your code and this should be more or less equivalent.

There's no need to wrap promises in another promise. Another thing is that promises can only resolve/reject to a single value, so there's no reject("some error", error) which is why I removed the .then or .catches that you had there.

Lastly, I added a rejection at the end in case any of the above conditions were not matched. If you don't do this, the function will return undefined, and you won't be able to await/.then/.catch it anymore.

if (itemsV.length >= 1 && itemsA.length === 1)
  return eFunc
    .createJob1(tag, inputs, 0, path)
    .then((job) => backend.update(vrID, null, status.IN_PROGRESS));

if (itemsV.length === 1 && itemsA.length > 1)
  return eFunc
    .createJob2(tag, inputs, 0, path)
    .then((job) => backend.update(vrID, null, status.IN_PROGRESS));

if (itemsV.length > 1 && itemsA.length > 1)
  return backend.update(vrID, null, status.FAILED).then((result) => "callback");

return Promise.reject("No matches?");

r/backtickbot • • Sep 22 '21

https://np.reddit.com/r/GoogleAppsScript/comments/pt65e9/simple_cp_script_combine_with_warning_dialog/hdu8r17/

0 Upvotes

Is it like this?

function LARegen() {
  var ui = SpreadsheetApp.getUi();
  var title = 'Confirm';
  var prompt = 'Type the initial'
  var response = ui.prompt(title, prompt, ui.ButtonSet.OK_CANCEL);
  if ( response.getResponseText() != 'LA' ){
    return;
  }

  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Items");
  spreadsheet.getRange('D3:D255').copyTo(spreadsheet.getRange('C3'), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);  
};

Here is a sample sheet.
Hope this helps. 😊


r/backtickbot • • Aug 17 '21

https://np.reddit.com/r/kubernetes/comments/p5ufmr/will_kubernetes_solve_my_problem/h9922mt/

0 Upvotes

It sounds like migrating to Kubernetes will fix some of your issues. I wouldn't recommend managing your own cluster starting off though. The hardest barrier that you're going to be overcoming every time is LoadBalancer type services and trying to understand storage classes. These are two things that I think most people just need to see working before they try to implement it themselves.

While GKE, EKS, and AKS are definitely expensive, there are other providers like Digital Ocean, Linode, Vultr, and Civo that provide managed Kubernetes at fixed rates.


Digital Ocean

Their platform is fine, but they some really weird limitations that can't be changed. 7 storage volumes per droplet (cloud server) is something I couldn't really live with. Also the load balancers have connection limitations.

Linode

I have yet to run into any arbitrary limits with Linode. Though I have a really old account that actually has some archaic stuff still attached to it. The only real problem I see with Linode is they've been hacked a few times and they still attach a non-private "private network" to all their servers. Why they do this is just beyond me. We know this is a problem, but I guess some companies never learn.

Vultr

I would hold off until next week on using VKE. It's still in beta, they're releasing a fix for quite a few issues that they had to date. One of them is with a primary Kubernetes certificate not being complete. From what I have probed so far, VKE looks very promising.

From the support ticket I have with them, this is what they provided in our last interaction as to what's being patched:

- Konnectivity support
- Aggregation Layer Support
- Installation NFS and CIFS libraries
- Addition of new storage class "WaitForFirstConsumer"
- Various other improvements

Civo

These guys do managed k3s hosting and it's quite impressive. I really do like it. My only problem it is just that I can't provision block volumes types. Both their CSI doesn't support it and the underlying storage controller for their cloud. This can be a very big deal breaker depending on what you need. Outside of that, I pretty much like everything else they have going on.


r/backtickbot • • Dec 30 '20

https://np.reddit.com/r/learnrust/comments/knd3j7/global_config_best_practice/ghjtk8l/

0 Upvotes

I would only use a global config if you configuration is loaded when the program starts and does not change.

For this use case, once_cell is good. Specifically, you would want something like:

use once_cell::sync::Lazy;

static CONFIG: Lazy<Config> = Lazy::new(|| { /* Code to load config */ });

If you need to be able to change the config but still have it be global, then you can make it a Lazy<Mutex<Config>>, but this type of global mutable state is generally discouraged.


r/backtickbot • • May 16 '21

https://np.reddit.com/r/Rlanguage/comments/ndjho4/looping_with_dplyr_a_question_and_a_follow_up/gyb5ivi/

0 Upvotes
library(tidyverse)

df %>% select(State, Marital_Status, Age_Group, Educ_Level, Housing_Type) %>%
   pivot_longer(everything(), names_to = "factor", values_to = "level") %>%
   count(factor, level)

r/backtickbot • • Jun 08 '21

https://np.reddit.com/r/FlutterDev/comments/nuxa6l/what_is_up_with_the_new_buttonstyle_property_for/h12q6jh/

0 Upvotes
TextButton(
      style: ButtonStyle(foregroundColor: MaterialStateProperty.all(Colors.red)),
    );

r/backtickbot • • Dec 16 '20

https://np.reddit.com/r/badcode/comments/ke6mae/there_cant_be_a_better_algorithm_for_counting_how/gg26i4h/

0 Upvotes

It depends on how the value is passed in! Say we have some function, aFunc:

// x is a copy of the original value passed in, and x can be mutated. It will not affect the original value.

void aFunc( int x );


// x is a pointer to the original value passed in, and x can be mutated. It will affect the original value. Access the x pointer’s value using the -> operator.

void aFunc( int * x );


// x is a reference to the original value passed in, and x can be mutated. It will affect the original value. Access the x pointer’s value using the . operator.

void aFunc( int & x );

Additionally you also have the const modifier you can apply to variables / parameters / functions.

// x is a copy of the original value passed in, and x cannot be mutated. (Kinda silly.) Changing it would not affect the original value.

void aFunc( int const x );

// x is a pointer to the original value passed in, and x cannot be mutated. Changing it would affect the original value. Access the x pointer’s value using the -> operator.

void aFunc( int const * x );


// x is a reference to the original value passed in, and x cannot be mutated. Changing it would affect the original value. Access the x reference’s value using the . operator.

void aFunc( int const & x );

There are more variations of the above, but these are the ones you’re most likely to encounter IMO


r/backtickbot • • Jun 15 '21

https://np.reddit.com/r/learnpython/comments/o0gb9x/whats_the_complexity_of_this_bfs_graph_traversal/h1uyx36/

0 Upvotes

I think O(V + E) is right if we are not inputting the vertices/nodes. It won't depend on the input, so it can be considered O(1).

This is just like

l = [2, 3, 5]
for i in l:
    print(i)

which is O(1) and doesn't depend on the length of the list.

Don't know for sure, though.


r/backtickbot • • Aug 17 '21

https://np.reddit.com/r/docker/comments/p62kf4/just_a_handydandy_bash_function_for_docker/h9a64jm/

0 Upvotes

Like... ?

function reset_docker() {
    docker ps -qa | xargs docker rm -f
    docker network ls -q | xargs docker network rm
    docker volume ls -q | xargs docker volume rm
    docker image ls -q | xargs docker rmi -f
}

r/backtickbot • • Apr 26 '21

https://np.reddit.com/r/196/comments/mym9b2/rule/gvxjizz/

0 Upvotes
⣿⣿⣿⠟⢹⣶⣶⣝⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⡟⢰⡌⠿⢿⣿⡾⢹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⢸⣿⣤⣒⣶⣾⣳⡻⣿⣿⣿⣿⡿⢛⣯⣭⣭⣭⣽⣻⣿⣿⣿
⣿⣿⣿⢸⣿⣿⣿⣿⢿⡇⣶⡽⣿⠟⣡⣶⣾⣯⣭⣽⣟⡻⣿⣷⡽⣿
⣿⣿⣿⠸⣿⣿⣿⣿⢇⠃⣟⣷⠃⢸⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣽
⣿⣿⣿⣇⢻⣿⣿⣯⣕⠧⢿⢿⣇⢯⣝⣒⣛⣯⣭⣛⣛⣣⣿⣿⣿⡇
⣿⣿⣿⣿⣌⢿⣿⣿⣿⣿⡘⣞⣿⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
⣿⣿⣿⣿⣿⣦⠻⠿⣿⣿⣷⠈⢞⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇
⣿⣿⣿⣿⣿⣿⣗⠄⢿⣿⣿⡆⡈⣽⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢻
⣿⣿⣿⣿⡿⣻⣽⣿⣆⠹⣿⡇⠁⣿⡼⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾
⣿⠿⣛⣽⣾⣿⣿⠿⠋⠄⢻⣷⣾⣿⣧⠟⣡⣾⣿⣿⣿⣿⣿⣿⡇⣿
⢼⡟⢿⣿⡿⠋⠁⣀⡀⠄⠘⠊⣨⣽⠁⠰⣿⣿⣿⣿⣿⣿⣿⡍⠗⣿
⡼⣿⠄⠄⠄⠄⣼⣿⡗⢠⣶⣿⣿⡇⠄⠄⣿⣿⣿⣿⣿⣿⣿⣇⢠⣿
⣷⣝⠄⠄⢀⠄⢻⡟⠄⣿⣿⣿⣿⠃⠄⠄⢹⣿⣿⣿⣿⣿⣿⣿⢹⣿
⣿⣿⣿⣿⣿⣧⣄⣁⡀⠙⢿⡿⠋⠄⣸⡆⠄⠻⣿⡿⠟⢛⣩⣝⣚⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣤⣤⣾⣿⣿⣄⠄⠄⠄⣴⣿⣿⣿⣇⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠛⠿⣿⣫⣾⣿

r/backtickbot • • Mar 29 '21

https://np.reddit.com/r/django/comments/meydnf/asynchronous_requests_to_api/gsnfj84/

0 Upvotes

Django now supports async views. so you can write your code like this.

async def test_view(request):
    rate = await get_rate()
    usd = rate['ratest']['USD']
    return render(request, '???.html', {'usd':usd})

r/backtickbot • • May 26 '21

https://np.reddit.com/r/rust/comments/nktnbq/rpgcli_your_filesystem_as_a_dungeon/gzhu5dy/

0 Upvotes

My first game:

~ $ rpg ./Documents/
~/Documents/ $ rpg ./carla
~/Documents/carla $ rpg ../class
💀

Got hit by carla. Killed in class.


r/backtickbot • • Mar 28 '21

https://np.reddit.com/r/Polybar/comments/mewdii/need_help_polybar_truncate_label_to_last_part/gskf5o4/

0 Upvotes

There is no way to slice certain characters off tokens. The numbers you put after the token names are the min length and max length of the token: https://github.com/polybar/polybar/wiki/Formatting#tokens

One thing you could do is to have multiple filesystem modules that inherit from the base module:

[module/filesystem]
type = internal/fs
interval = 25

label-unmounted-foreground = ${colors.foreground-alt}
...

[module/fs-root]
inherit = module/filesystem
mount-0 = /

label-mounted = /: %percentage_used%%
label-unmounted = / not mounted

[module/fs-data]
inherit = module/filesystem
mount-1 = /home/work/Data

label-mounted = /Data: %percentage_used%%
label-unmounted = /Data not mounted

r/backtickbot • • Jun 04 '21

https://np.reddit.com/r/ProgrammerHumor/comments/nrk9dj/so_true/h0ihqjn/

0 Upvotes

Yea but what about

public Class {
private String str;
public Class(String str) {
this.str = null ? "" : str;
}
}

r/backtickbot • • Jun 28 '21

https://np.reddit.com/r/cpp/comments/o8t2h9/its_so_weird_seeing_msvc_support_c20_and_clang/h3dlulk/

0 Upvotes

Hi arturbac,

I just checked out the project and I notice that we fail to compile it due to some UB with your defined type traits: fixed_lib/include/fixedmath/limits.h This is not allowed by the standard and MSVC takes advantage of this to implement some optimizations.

I was also unable to reproduce the compiler ICE you observed in your static assertion. Here's the output I see:

$ cl -std:c++20 -c -EHsc -Ifixed_math\fixed_lib\include -TP fixed_math\fixed_lib\include\fixedmath\unittests\compile_time_unit_tests.h
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\compile_time_unit_tests.h(25): error C2338: dont expect constexpr will work on this broken compiler. Expect cl crash and internal compiler error
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\type_traits.h(36): error C2607: static assertion failed
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\type_traits.h(37): error C2607: static assertion failed
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2825: 'T': must be a class or namespace when followed by '::'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(28): note: see reference to class template instantiation 'fixedmath::assert_equal_t<const T,const T>' being compiled
        with
        [
            T=fixedmath::fixed_internal
        ]
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(28): note: while compiling class template member function 'bool fixedmath::assert_equal_t<fixedmath::const_val<fixedmath::fixed_internal,65536>,fixedmath::const_val<fixedmath::fixed_internal,65536>>::eq(void)'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\misc_functions.h(30): note: see reference to class template instantiation 'fixedmath::assert_equal_t<fixedmath::const_val<fixedmath::fixed_internal,65536>,fixedmath::const_val<fixedmath::fixed_internal,65536>>' being compiled
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2510: 'T': left of '::' must be a class/struct/union
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2065: 'value': undeclared identifier
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2825: 'U': must be a class or namespace when followed by '::'
E:\Documents\git_projects\fixed_math\fixed_lib\include\fixedmath\unittests\unit_test_common.h(35): error C2510: 'U': left of '::' must be a class/struct/union

Do you have a different set of options?


r/backtickbot • • Mar 28 '21

https://np.reddit.com/r/LivestreamFail/comments/merzwv/discussion_the_increased_rate_of_advertisements/gskhfic/

0 Upvotes

just looked into my pihole settings:

 Match found in https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts:
   aan.amazon-adsystem.com 
   aax.amazon-adsystem.com 
   aax-eu-retail-direct.amazon-adsystem.com 
   aax-fe.amazon-adsystem.com 
   aax-fe-sin.amazon-adsystem.com 
   aax-us.amazon-adsystem.com 
   aax-us-east.amazon-adsystem.com 
   c.amazon-adsystem.com 
   cdn-a.amazon-adsystem.com 
   fls-eu.amazon-adsystem.com 
   fls-fe.amazon-adsystem.com 
   fls-na.amazon-adsystem.com 
   mads.amazon-adsystem.com 
   s.amazon-adsystem.com 
   vaes.amazon-adsystem.com 
   ws-eu.amazon-adsystem.com 
   z-eu.amazon-adsystem.com 
   rcm-eu.amazon-adsystem.com 
   wms-eu.amazon-adsystem.com 
   wms-na.amazon-adsystem.com 
   ws-na.amazon-adsystem.com 
   aax-eu.amazon-adsystem.com 
   ir-de.amazon-adsystem.com 
   ir-uk.amazon-adsystem.com 
   ps-eu.amazon-adsystem.com 
   ps-us.amazon-adsystem.com 
   z-na.amazon-adsystem.com 
   aax-us-east-rtb.amazon-adsystem.com 
   ir-na.amazon-adsystem.com 
   rcm-na.amazon-adsystem.com 
   aax-cpm.amazon-adsystem.com 
   aax-us-pdx.amazon-adsystem.com 
   amazon-adsystem.com 
   dra.amazon-adsystem.com 
   ws-ea.amazon-adsystem.com 
   ir-jp.amazon-adsystem.com 
   ps-jp.amazon-adsystem.com 
   rcm-fe.amazon-adsystem.com 
   ws-fe.amazon-adsystem.com 
 Match found in http://sysctl.org/cameleon/hosts:
   aax-eu.amazon-adsystem.com 
   aax-us-east-rtb.amazon-adsystem.com 
   aax-us-east.amazon-adsystem.com 
   aax.amazon-adsystem.com 
   c.amazon-adsystem.com 
   fls-eu.amazon-adsystem.com 
   fls-na.amazon-adsystem.com 
   ir-de.amazon-adsystem.com 
   ir-na.amazon-adsystem.com 
   ir-uk.amazon-adsystem.com 
   ps-eu.amazon-adsystem.com 
   ps-us.amazon-adsystem.com 
   rcm-eu.amazon-adsystem.com 
   rcm-na.amazon-adsystem.com 
   s.amazon-adsystem.com 
   wms-eu.amazon-adsystem.com 
   wms-na.amazon-adsystem.com 
   ws-eu.amazon-adsystem.com 
   ws-na.amazon-adsystem.com 
   z-na.amazon-adsystem.com 
 Match found in https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt:
   amazon-adsystem.com 

and I still have ads if I don't log in :( Might be DNS setting tho, got to check if DNS over HTTPS is activated on and stuff.


r/backtickbot • • May 23 '21

https://np.reddit.com/r/golang/comments/niv6ax/stdlib_of_pipewrite_why_it_has_the_line_b_bnw/gz4sk57/

0 Upvotes

And another question - why do we need once here? Looks like without it will be the same:

	for ; len(b) > 0; {
		select {
		case p.wrCh <- b:
			nw := <-p.rdCh
			b = b[nw:] // WHY?
			n += nw
		case <-p.done:
			return n, p.writeCloseError()
		}
	}

r/backtickbot • • Sep 11 '21

https://np.reddit.com/r/vuejs/comments/plch7l/vueselect_alternative_for_vue_3/hcf9wol/

0 Upvotes

Very straight forward, just use the vite-plugin-vue2 package instead. (Example from our code base with Tsx/Jsx config)

import { defineConfig } from "vite"

import { createVuePlugin } from "vite-plugin-vue2"  
export default defineConfig({  build: {},    
  plugins: [  
     createVuePlugin({ 
     jsx: true,      
      jsxOptions: {   injectH: true,  
                      vModel: false,        
                      compositionAPI: true, 
    },    }),  ],
})

r/backtickbot • • Jan 26 '21

https://np.reddit.com/r/backtickbot/comments/l5but6/httpsnpredditcomrbacktickbotcommentsl5bulohttpsnpr/gkt9bdl/

0 Upvotes

among us sus 😳😮😂!!!!!!

⠀⠀⠀⡯⡯⡾⠝⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢊⠘⡮⣣⠪⠢⡑⡌

⠀⠀⠀⡯⡯⡾⠝⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢊⠘⡮⣣⠪⠢⡑⡌ 
⠀⠀⠀⠟⠝⠈⠀⠀⠀⠡⠀⠠⢈⠠⢐⢠⢂⢔⣐⢄⡂⢔⠀⡁⢉⠸⢨⢑⠕⡌ ㅤ
 ⠀⠀⡀⠁⠀⠀⠀⡀⢂⠡⠈⡔⣕⢮⣳⢯⣿⣻⣟⣯⣯⢷⣫⣆⡂⠀⠀⢐⠑⡌
 ⢀⠠⠐⠈⠀⢀⢂⠢⡂⠕⡁⣝⢮⣳⢽⡽⣾⣻⣿⣯⡯⣟⣞⢾⢜⢆⠀⡀⠀⠪
 ⣬⠂⠀⠀⢀⢂⢪⠨⢂⠥⣺⡪⣗⢗⣽⢽⡯⣿⣽⣷⢿⡽⡾⡽⣝⢎⠀⠀⠀⢡
 ⣿⠀⠀⠀⢂⠢⢂⢥⢱⡹⣪⢞⡵⣻⡪⡯⡯⣟⡾⣿⣻⡽⣯⡻⣪⠧⠑⠀⠁⢐
 ⣿⠀⠀⠀⠢⢑⠠⠑⠕⡝⡎⡗⡝⡎⣞⢽⡹⣕⢯⢻⠹⡹⢚⠝⡷⡽⡨⠀⠀⢔
 ⣿⡯⠀⢈⠈⢄⠂⠂⠐⠀⠌⠠⢑⠱⡱⡱⡑⢔⠁⠀⡀⠐⠐⠐⡡⡹⣪⠀⠀⢘
 ⣿⣽⠀⡀⡊⠀⠐⠨⠈⡁⠂⢈⠠⡱⡽⣷⡑⠁⠠⠑⠀⢉⢇⣤⢘⣪⢽⠀⢌⢎
 ⣿⢾⠀⢌⠌⠀⡁⠢⠂⠐⡀⠀⢀⢳⢽⣽⡺⣨⢄⣑⢉⢃⢭⡲⣕⡭⣹⠠⢐⢗
 ⣿⡗⠀⠢⠡⡱⡸⣔⢵⢱⢸⠈⠀⡪⣳⣳⢹⢜⡵⣱⢱⡱⣳⡹⣵⣻⢔⢅⢬⡷
 ⣷⡇⡂⠡⡑⢕⢕⠕⡑⠡⢂⢊⢐⢕⡝⡮⡧⡳⣝⢴⡐⣁⠃⡫⡒⣕⢏⡮⣷⡟
 ⣷⣻⣅⠑⢌⠢⠁⢐⠠⠑⡐⠐⠌⡪⠮⡫⠪⡪⡪⣺⢸⠰⠡⠠⠐⢱⠨⡪⡪⡰
 ⣯⢷⣟⣇⡂⡂⡌⡀⠀⠁⡂⠅⠂⠀⡑⡄⢇⠇⢝⡨⡠⡁⢐⠠⢀⢪⡐⡜⡪⡊
 ⣿⢽⡾⢹⡄⠕⡅⢇⠂⠑⣴⡬⣬⣬⣆⢮⣦⣷⣵⣷⡗⢃⢮⠱⡸⢰⢱⢸⢨⢌
 ⣯⢯⣟⠸⣳⡅⠜⠔⡌⡐⠈⠻⠟⣿⢿⣿⣿⠿⡻⣃⠢⣱⡳⡱⡩⢢⠣⡃⠢⠁
 ⡯⣟⣞⡇⡿⣽⡪⡘⡰⠨⢐⢀⠢⢢⢄⢤⣰⠼⡾⢕⢕⡵⣝⠎⢌⢪⠪⡘⡌⠀
 ⡯⣳⠯⠚⢊⠡⡂⢂⠨⠊⠔⡑⠬⡸⣘⢬⢪⣪⡺⡼⣕⢯⢞⢕⢝⠎⢻⢼⣀⠀
 ⠁⡂⠔⡁⡢⠣⢀⠢⠀⠅⠱⡐⡱⡘⡔⡕⡕⣲⡹⣎⡮⡏⡑⢜⢼⡱⢩⣗⣯⣟
 ⢀⢂⢑⠀⡂⡃⠅⠊⢄⢑⠠⠑⢕⢕⢝⢮⢺⢕⢟⢮⢊⢢⢱⢄⠃⣇⣞⢞⣞⢾
 ⢀⠢⡑⡀⢂⢊⠠⠁⡂⡐⠀⠅⡈⠪⠪⠪⠣⠫⠑⡁⢔⠕⣜⣜⢦⡰⡎⡯⡾⡽

r/backtickbot • • Dec 08 '20

https://np.reddit.com/r/functionalprogramming/comments/k99t81/can_a_function_call_another_function/gf3b791/

0 Upvotes

Not a functional programmer, but read a lot about it. I'll be using Typescript.

A function that calls a parameter is as pure as the called parameter. For example, you have the following function call:

function call(f: () => int): int {
    return f();
}

    
    We might use the `call` function as a pure function or an impure function:
typescript
let x = call(() => 1); // call is pure
let y = call(() => {
    x = 2;
    return 1;
}); //call is impure

r/backtickbot • • Jul 22 '21

https://np.reddit.com/r/redditdev/comments/opie2h/how_do_i_auto_save_postscomments/h65f8s0/

0 Upvotes

so for posts i can do:

post_ids = ['asd','dfg','asda']
for id in post_ids :
reddit.post(id).save()

r/backtickbot • • Mar 09 '21

https://np.reddit.com/r/wallstreetbets/comments/m0kf6k/i_programmed_my_leds_to_change_colours_depending/gqb30zw/

0 Upvotes

I didn't realize that to have recent data it cost money

The URL I used was for the price target - not the current price, so it hasn't been updated in some time. If you want the current price, you can check the quote: https://finnhub.io/api/v1/quote?symbol=AAPL&token=sandbox_aaaaaaaaaa which returns the following:

{
  "c":116.36,
  "h":121,
  "l":116.21,
  "o":120.93,
  "pc":121.42,
  "t":1615248000
}

According to the documentation, c is the current price, h is the high price (of the day), l is the low price (of the day), o is the open price, pc is the previous close, and t is not documented - I assume it's a timestamp.

You can also use websockets or webhooks to get live data, where calling the /quote/ url is limited by the 60 checks/minute rate limit.

Also this all looks like it's python ...

The examples I linked are in Python, but the documentation includes a few other versions. They're HTTP "GET" requests, so basically it applies to any language. The returned data is in JSON, which is just a string of data formatted a certain way.

You can make HTTP GET requests in C, here is an example using libcurl.


r/backtickbot • • Nov 12 '20

https://reddit.com/r/wholesomehentai/comments/jt0xck/giuniu_just_posting_an_old_favourite/gc2pts3/

0 Upvotes

Reply to this comment with the source, in regular link format, such as

https://nhentai.net/g/(numbers).

If you feel like your post has no applicable source, reply with "None".

I am not a bot. I am being forced to mod this sub. Please send food and water

Wholesome List | GitHub | Discord


r/backtickbot • • May 29 '21

https://np.reddit.com/r/MensRights/comments/nnckb0/magdalena_skipper_nature_eic_what_did_it_take_for/gzvr7mf/

0 Upvotes

This is great, I support this talk about suicide in a gender neutral way The commentary from this tweet isn't about japan though, this is a Western (British) woman pointing at Japan as an example to talk about the rest of the world. This entire conversation also fails to take into account that up until 2020, male suicide rates have been falling proportionally more slowly than female suicide rates (based on OP's image) since 2011.

The maths from 2011-2019 is

female suicide rate drop = 9.4/14.8 = 63.6% of what it was
male suicide rate drop   = 22.9/33.7 = 68.0% of what it was

If we take the last year into account, the overall female drop in rates is 73.6% which as we have discussed is a sharp increase vs the previous year.

This shows that apart from last year whatever has been done over the previous decade to combat suicide rates in Japan has been more effective with women and there's been no action (whether there has been none or it simply has not been effective I do not know) to more strongly catering towards the group that has traditionally been between 2 and 3 times larger.

If you had two groups labelled A and B and one was killing themselves at a 2-3x higher rate, you'd hope more would be done to target this significantly larger group, no?