A Pen by Dhilip kumar on CodePen.
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
| let strs = ["kita", "atik", "tika", "aku", "kia", "makan", "kua"]; | |
| function sortString(str) { | |
| var arr = str.split(""); | |
| var tmp; | |
| for (var i = 0; i < arr.length; i++) { | |
| for (var j = i + 1; j < arr.length; j++) { | |
| if (arr[i] > arr[j]) { | |
| tmp = arr[i]; | |
| arr[i] = arr[j]; |
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
| /* | |
| JavaScript Caesar shift | |
| by Evan Hahn (evanhahn.com) | |
| * * * * * * * * * * * * | |
| For small occasions (like month-anniversaries), I like to make little websites | |
| for people that only "unlock" on the right day. |
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 express = require('express'); | |
| var path = require('path'); | |
| var webpackConfig = require('./webpack.config'); | |
| var webpack = require('webpack'); | |
| var webpackDevMiddleware = require('webpack-dev-middleware'); | |
| var webpackHotMiddleware = require('webpack-hot-middleware'); | |
| var proxyMiddleware = require('http-proxy-middleware'); | |
| var devConfig = webpackConfig.devServer; | |
| var app = express(); |
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
| # Created by https://www.gitignore.io/api/node,phpstorm+all,visualstudiocode | |
| # Edit at https://www.gitignore.io/?templates=node,phpstorm+all,visualstudiocode | |
| ### Node ### | |
| # Logs | |
| logs | |
| *.log | |
| npm-debug.log* | |
| yarn-debug.log* | |
| yarn-error.log* |
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
| //@flow | |
| import React, { Component } from 'react' | |
| import type { ElementRef } from 'react' | |
| type Props = { src: string, alt: string } | |
| type State = { source?: string } | |
| export default class LazyImage extends Component<Props, State> { | |
| state = {} |
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 MySqlDb(object): | |
| def run(self, query): | |
| # whatever... | |
| # ---------------------------------------------------------------------- | |
| # Here, Foo can get bars, AND knows exactly what db implementation to use: | |
| class Foo: | |
| def __init__(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
| // Mixin like functionality | |
| const textInput = props => ` | |
| color: ${props.error ? color.white : color.base}; | |
| background-color: ${props.error ? color.alert : color.white}; | |
| `; | |
| export const Input = styled.input` | |
| ${textInput} | |
| `; |
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
| { | |
| tokens=[ | |
| space='regexp:\s+' | |
| identifier='regexp:[a-zA-Z][a-zA-Z0-9_]*' | |
| integer-constant='regexp:\d+' | |
| character-constant='regexp:[a-zA-Z]' | |
| floating-constant='regexp:[+-]?([0-9]*[.])?[0-9]+f' | |
| enumeration-constant='regexp:[a-zA-Z][a-zA-Z0-9_]*' // Same as identifier | |
| ] |
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
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { | |
| // no easing, no acceleration | |
| linear: function (t) { return t }, | |
| // accelerating from zero velocity | |
| easeInQuad: function (t) { return t*t }, | |
| // decelerating to zero velocity |
NewerOlder