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 { useEffect, useRef } from 'react'; | |
type draw = (fraction: number) => void; | |
type duration = number; | |
const useAnimation = (duration: duration, draw: draw) => { | |
const updateDurationRef = useRef<null | ((newDuration: number) => void)>(null); | |
const currentAnimationIdRef = useRef(0); | |
const elapsedTimeRef = useRef(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
// semver.js | |
function isValidSemVer(version) { | |
const semverRegex = /^(\d+)\.(\d+)\.(\d+)(?:-([\w\d]+(?:\.[\w\d]+)*))?(?:\+([\w\d]+(?:\.[\w\d]+)*))?$/; | |
if (!semverRegex.test(version)) { | |
return false; | |
} | |
return true; |
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 a minimal reproducible example to illustrate how deno is attempting to execute | |
# an html file passed in as a value for --watch option | |
# | |
# tested with deno 1.24.3 and 1.32.1 | |
% mkdir html | |
% touch html/index.html | |
% echo "<\!doctype html>" >> html/index.html | |
% touch build.js | |
% echo "console.log('build running');" >> build.js |
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
public class NotificationsModule extends ReactContextBaseJavaModule { | |
private static String channelID = "8888"; | |
private static String channelTitle = "Notifications"; | |
private ReactApplicationContext reactContext; | |
public static final String NAME = "Notifications"; | |
NotificationsModule(ReactApplicationContext context) { | |
super(context); | |
reactContext = context; |
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 com.foo.bar; | |
import android.util.Log; | |
import android.content.Context; | |
import android.provider.Settings; | |
import java.lang.System; | |
import android.app.Notification; | |
import androidx.core.app.NotificationCompat; |
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
ipcMain.on('facebook-sign-on', function onFacebookSignOn( | |
event, | |
repromptFacebook, | |
) { | |
const options = { | |
client_id: FACEBOOK_CLIENT_ID, | |
scope: 'public_profile,email', | |
redirect_uri: 'https://www.facebook.com/connect/login_success.html', | |
auth_type: repromptFacebook ? 'rerequest' : '', |
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
source ~/.git-prompt.sh | |
#[18:39:16] ~/railscode/dostuff (dev)$ | |
export PS1='\[$(tput setaf 4)\]┌\[$(tput sgr0)\] \[\033[0;36m\][\t]\[\033[0m\] \[\033[0;32m\]\w\[\033[0m\]\[\033[0;33m\]$(__git_ps1)\[\033[0m\]\n\[$(tput setaf 4)\]└\[$(tput sgr0)\] ' | |
source ~/git-completion.bash |
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
/** | |
* Get bounding box from set of coordinates [lat,lng] and distance in (deg) adopted to JS | |
* | |
* @param {number} distance - distance (deg) from the point represented by centerPoint | |
* @param {array} centerPoint - two-dimensional array containing center coords [latitude, longitude] | |
* @description | |
* Computes the bounding coordinates of all points on the surface of a sphere | |
* that has a great circle distance to the point represented by the centerPoint | |
* argument that is less or equal to the distance argument. | |
* Technique from: Jan Matuschek <http://JanMatuschek.de/LatitudeLongitudeBoundingCoordinates> |
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
var minifyJS = require('uglify-js').minify; | |
var minifyHTML = require('html-minifier').minify; | |
// TODO: use lodash.template when Travis | |
// updates npm version to >= 3 | |
var _ = require('lodash'); | |
var path = require('path'); | |
var fs = require('fs'); | |
function toMinifiedSource(compilation, path) { | |
return minifyJS( |
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
var createRedux = require('redux').createRedux; | |
var reducer = function (state, action) { | |
return state; | |
}; | |
var redux = createRedux(reducer); | |
redux.dispatch({ | |
type: 'FOO', | |
payload: {} | |
}); |
NewerOlder