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
defmodule WSSWeb.IntrusmentChannel do | |
use Phoenix.Channel | |
def join("instrument_info:" <> trading_symbol, _message, socket) do | |
IO.puts("Joined topic instrument_info:#{trading_symbol}") | |
{:ok, socket} | |
end | |
def terminate(reason, socket) do | |
IO.puts("Closing socket #{inspect(reason)} , #{inspect(socket.topic)}") |
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
Erlang/OTP 21 [erts-10.0.8] [source] [64-bit] | |
Interactive Elixir (1.10.1) - press Ctrl+C to exit (type h() ENTER for help) | |
iex(1)> dates = [~D[2018-01-31],~D[2019-02-01],~D[2020-03-01]] | |
[~D[2018-01-31], ~D[2019-02-01], ~D[2020-03-01]] | |
iex(2)> dates |> Enum.sort() | |
[~D[2019-02-01], ~D[2020-03-01], ~D[2018-01-31]] | |
iex(3)> dates |> Enum.sort(&(Date.compare(&1, &2) != :lt)) | |
[~D[2020-03-01], ~D[2019-02-01], ~D[2018-01-31]] | |
iex(4)> dates |> Enum.sort(Date) |
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, { | |
ComponentProps, | |
useCallback, | |
useEffect, | |
useMemo, | |
useRef, | |
useState, | |
} from "react"; | |
import { Dimensions, FlatList, ListRenderItem, Animated } from "react-native"; | |
import { Text, View } from "react-native-animatable"; |
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 _ from 'lodash'; | |
type T = { | |
option?: any; | |
cases?: 'snakeCase' | 'camelCase'; | |
url: string; | |
}; | |
const dynamicUrl = ({ option, url, cases }: T) => { | |
let endPoint = 'http://localhost:3000' + url; |
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
function useComputedValue(...allArgs) { | |
// normally setting current during render like this is not good and you'll | |
// want to do that in a useEffect. | |
// However, we need access to these values *during* render. | |
const args = React.useRef() | |
args.current = allArgs | |
const ref = React.useRef() | |
if (!ref.current) { | |
ref.current = {} | |
Object.defineProperty(ref.current, 'result', { |
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
--- | |
# ansible 2.9.0 | |
- name: Deploy to production | |
hosts: production | |
remote_user: user | |
vars: | |
app_root: /home/user/apps/my_app | |
tasks: |
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 android.annotation.SuppressLint; | |
import android.annotation.TargetApi; | |
import android.app.AppOpsManager; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.text.TextUtils; | |
import java.lang.reflect.Method; | |
// MIUI. Redefining Android. |
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 android.app.AlertDialog; | |
import android.content.ComponentName; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.SharedPreferences; | |
import android.content.pm.ApplicationInfo; | |
import android.content.pm.PackageManager; | |
import android.os.Build; |
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
@SuppressLint("WrongConstant") | |
public static boolean canDrawOverlays(Context context) { | |
if (Build.VERSION.SDK_INT >= 23) { | |
return Settings.canDrawOverlays(context); | |
} else { | |
if (Build.MANUFACTURER.equalsIgnoreCase("xiaomi")) { | |
return true; | |
} | |
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService("appops"); | |
Method method = null; |
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 android.provider.Settings; | |
import com.facebook.react.bridge.ReactApplicationContext; | |
import com.facebook.react.bridge.ReactContext; | |
import com.facebook.react.bridge.ReactContextBaseJavaModule; | |
import com.facebook.react.bridge.ReactMethod; | |
import android.util.Log; | |
import android.net.Uri; |
OlderNewer