Skip to content

Instantly share code, notes, and snippets.

View abhinavraj23's full-sized avatar
🎯
Focusing

Abhinav Raj abhinavraj23

🎯
Focusing
View GitHub Profile
SELECT table,
formatReadableSize(sum(bytes)) as size,
min(min_date) as min_date,
max(max_date) as max_date
FROM system.parts
WHERE active
GROUP BY table
@abhinavraj23
abhinavraj23 / dump.sql
Created May 7, 2021 06:50 — forked from AlexeyKupershtokh/dump.sql
Postgres DDL to Clickhouse converter
select
concat(
'create table ',
table_name,
'(',
string_agg(
concat(
column_name,
' ',
CASE when is_nullable = 'YES' THEN 'Nullable(' END,
<DataSearch
componentId={id}
dataField="original_title"
URLParams
className="search-container"
showIcon={false}
autosuggest={true}
react={{ and: ["ResultList"] }}
iconPosition="right"
innerClass={{ input: "search-input", list: "search-list" }}
renderCustomSuggestions() {
return ({ loading, error, data, value, downshiftProps: { isOpen, getItemProps } }) => {
if (loading) {
return <div>Fetching Suggestions.</div>;
}
if (error) {
return <div>Something went wrong!Error details {JSON.stringify(error)}</div>;
}
console.log("STATE", this.state.popular_searches);
return isOpen && Boolean(value.length) ? ([
getPopularSearches = value => {
var headers = new Headers();
//This the DSL query for searching according to given value
const data = {
"query": {
"bool": {
"must": [
{
"bool": {
"must": {
<DataSearch
title="DataSearch"
dataField={["original_title", "original_title.search"]}
onValueChange={value => {
console.log("value is: ", value);
// make the pop search REST API call here
// save the result in the state
// use that state inside the `render` prop for DataSearch to show the popular searches alongside the product search results.
}}
/>
dependencies {
implementation 'com.github.appbaseio:android-searchbox:tag'
}
searchBar.setOnSearchActionListener(new SearchBar.OnSearchActionListener() {
@Override
public void onSearchStateChanged(boolean enabled) {
String state = enabled ? "enabled" : "disabled";
Toast.makeText(getApplicationContext(), "Search bar is " + state, Toast.LENGTH_SHORT).show();
}
@Override
public void onSearchConfirmed(CharSequence text) {
Toast.makeText(getApplicationContext(), "Search query is: " + text, Toast.LENGTH_SHORT).show();
<com.example.searchwidget.SearchBar
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:maxSuggestionsCount="10"
app:hint="Search Books"
app:placeholder="Search" />
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}