This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package paginator | |
import ( | |
"context" | |
"database/sql" | |
"errors" | |
"github.com/uptrace/bun" | |
"math" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE SEQUENCE public.global_id_seq; | |
ALTER SEQUENCE public.global_id_seq OWNER TO postgres; | |
CREATE OR REPLACE FUNCTION public.id_generator() | |
RETURNS bigint | |
LANGUAGE 'plpgsql' | |
AS $BODY$ | |
DECLARE | |
our_epoch bigint := 1314220021721; | |
seq_id bigint; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Downloading a static resource, already saved to disk | |
@GetMapping(value = "/") | |
public ResponseEntity download() throws IOException { | |
var file = new File("/path/to/file"); | |
var header = new HttpHeaders(); | |
header.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName()); // you can use any name you want here | |
header.add("Cache-Control", "no-cache, no-store, must-revalidate"); | |
header.add("Pragma", "no-cache"); | |
header.add("Expires", "0"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT to_date('01/01/1900','DD/MM/YYYY') + NUMBER_OF_DAYS - 2 FROM DUAL | |
select * from INF_LR_POOL WHERE REGEXP_LIKE(POOL_ONAIR_DATE, '\d{5}') | |
UPDATE INF_UR_POOL SET POOL_ONAIR_DATE = to_char(to_date('01/01/1900','DD/MM/YYYY') + POOL_ONAIR_DATE - 2, 'YYYY-MM-DD')WHERE REGEXP_LIKE(POOL_ONAIR_DATE, '\d{5}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
import { Modal, Input, Form } from 'antd'; | |
const FormItem = Form.Item; | |
const { TextArea } = Input; | |
const formItemLayout = { | |
wrapperCol: { | |
span: 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters\ /v AllowEncryptionOracle /t REG_DWORD /d 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Papa from 'papaparse'; | |
import { saveAs } from 'file-saver/FileSaver'; | |
export default async ({ payload, filename }) => { | |
saveAs( | |
new Blob([Papa.unparse(payload)], { type: 'text/plain;charset=utf-8' }), | |
`${filename}.csv` | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// true-type-of.js | |
export const trueTypeOf = input => Object.prototype.toString.call(input) | |
.replace(/(\[object |\])/ig, '') | |
.toLowerCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is an example of using elastic's BulkProcessor with Elasticsearch. | |
// | |
// See https://github.com/olivere/elastic and | |
// and https://github.com/olivere/elastic/wiki/BulkProcessor | |
// for more details. | |
/* | |
* This example illustrates a simple process that performs bulk processing | |
* with Elasticsearch using the BulkProcessor in elastic. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dapper; | |
using Oracle.ManagedDataAccess.Client; | |
using System; | |
using System.Collections.Generic; | |
using System.Data; | |
using System.Linq; | |
public class OracleDynamicParameters : Dapper.SqlMapper.IDynamicParameters { | |
private static Dictionary<SqlMapper.Identity, Action<IDbCommand, object>> paramReaderCache = new Dictionary<SqlMapper.Identity, Action<IDbCommand, object>>( ); |
NewerOlder