Skip to content

Instantly share code, notes, and snippets.

type TypeMap = {
'number?'?: number;
number: number;
'string?'?: string;
string: string;
'boolean?'?: boolean;
boolean: boolean;
};
type OptionsArg = {
Fresh semver-parser v0.7.0
Fresh autocfg v0.1.6
Fresh rand_core v0.4.2
Fresh unicode-xid v0.2.0
Fresh lazy_static v1.4.0
Fresh nodrop v0.1.13
Fresh cfg-if v0.1.9
Fresh stable_deref_trait v1.1.1
Fresh scopeguard v0.3.3
Fresh smallvec v0.6.10
import System.Random
getRandomWord :: [String] -> IO String
getRandomWord words =
do n <- randomRIO (0, min 0 ((length words) - 1))
return $ words !! n
check :: String -> String -> Char -> (Bool,String)
check word display c
= (c `elem` word, [if x==c
@beshanoe
beshanoe / Spinner.js
Created August 7, 2017 14:07 — forked from knowbody/Spinner.js
Spinner - using styled-components
import React from 'react';
import styled from 'styled-components';
const rotate = keyframes`
100% {
transform: rotate(360deg);
}
`
const dash = keyframes`
@beshanoe
beshanoe / aem1k_symmetry.js
Last active February 20, 2018 01:36
aem1k symmetry explanation
// I've passed the original symmetrical code through the Prettier
// Most of the lines do nothing but make code look symmetrical
// Still it's amazing :)
{
0.0 - {} - 0
}
xXXx = wYYw = // 'alert(xXXx)'
([] + !!+[])[0 ** 0.0] + // 'a'
[[]] + // ''
@beshanoe
beshanoe / js-interview.js
Last active May 26, 2017 11:05
ES2015 Interview Questions
// 1
var foo = 2
function bar() {
if (!foo) {
var foo = 5
}
console.log(foo)
}
bar()
@beshanoe
beshanoe / vue2angular.ts
Created April 5, 2017 16:36
How to use vue component in Angular 1.5 (based on react2angular)
import { IAugmentedJQuery, IComponentOptions } from 'angular'
import { fromPairs, keys, merge } from 'lodash'
import NgComponent from 'ngcomponent'
import * as Vue from 'vue'
export function vue2angular<Props>(
Component: Vue.ComponentOptions<Vue>
): IComponentOptions {
let names: string[];
if (Component.props) {
chrome.extension.sendMessage({}, function (response) {
var readyStateCheckInterval = setInterval(function () {
if (document.readyState === "complete") {
clearInterval(readyStateCheckInterval);
console.log("TP Copy extension now works!");
setInterval(function () {
if (!document.getElementById('copybaba')) {
if (document.querySelector('.ui-title')) {
function cop(text) {
if (document.execCommand) {
var textArea = $('<textarea></textarea>');
textArea.css({
position: 'absolute',
top: 0,
left: -10000
});
textArea.val(text);
$(document.body).append(textArea);
scrollSensitive