This file contains hidden or 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
| WITH RECURSIVE tiers (a, b, c) AS MATERIALIZED ( | |
| SELECT | |
| * | |
| FROM | |
| "tiers" | |
| WHERE | |
| NOT ( | |
| EXISTS ( | |
| SELECT | |
| * |
This file contains hidden or 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
| class Object | |
| def true? | |
| return unless self | |
| tmp = yield | |
| return tmp | |
| end | |
| def else | |
| return yield unless self | |
| self |
This file contains hidden or 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
| /** @jsx React.DOM */ | |
| var LopMonHoc = React.createClass({ | |
| getInitialState: function(){ | |
| return {data: []} | |
| }, | |
| loadData: function(){ | |
| $.ajax({ | |
| url: '/daotao/lops', | |
| success: function(data){ |
This file contains hidden or 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
| const fs = require('fs'); | |
| const path = require('path'); | |
| const acorn = require('acorn'); | |
| const walk = require('acorn-walk'); | |
| // List of React hooks to look for | |
| const hooks = ['useState', 'useEffect', 'useContext', 'useReducer', 'useCallback', 'useMemo', 'useRef', 'useImperativeHandle', 'useLayoutEffect', 'useDebugValue']; | |
| // Function to check if a file contains React hooks | |
| const containsReactHooks = (code) => { |
This file contains hidden or 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
| var _wr = function(type) { | |
| var orig = history[type]; | |
| return function() { | |
| var rv = orig.apply(this, arguments); | |
| var e = new Event(type); | |
| e.arguments = arguments; | |
| window.dispatchEvent(e); | |
| return rv; | |
| }; | |
| }; |
This file contains hidden or 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 'dart:io'; | |
| import 'package:path/path.dart'; | |
| import 'package:sqflite/sqflite.dart'; | |
| import 'package:path_provider/path_provider.dart'; | |
| class DatabaseHelper { | |
| static final _databaseName = "MyDatabase.db"; | |
| static final _databaseVersion = 1; |
This file contains hidden or 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
| // if you don't plan to upload only images : | |
| /* | |
| async function convertToFile(data: AsyncIterable<Uint8Array>) { | |
| const chunks = []; | |
| for await (const chunk of data) { | |
| chunks.push(chunk); | |
| } | |
| return chunks; | |
| } |
This file contains hidden or 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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains hidden or 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 { Alert } from "react-native"; | |
| import * as WebBrowser from "expo-web-browser"; | |
| import { useSupabaseClient } from "@supabase/auth-helpers-react"; | |
| import { initiateAppleSignIn } from "../utils/auth"; | |
| export const useAuth = () => { | |
| const Supabase = useSupabaseClient(); | |
| const signInWithPassword = async ( |
NewerOlder