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
| npm ls | grep -v 'npm@' | awk '/@/ {print $2}' | awk -F@ '{print $1}' | xargs npm rm |
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 numbers = [6, 3, 9]; | |
| function map(data,func){ | |
| let numbers = []; | |
| for (let i in data){ | |
| let as = func(data[i]); | |
| numbers.push(as); | |
| } | |
| return numbers; | |
| } |
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 PULL_DATA= 'PULL_DATA' | |
| import agent from 'superagent' | |
| const initialState = { | |
| apiFeed:[], | |
| loaded:false | |
| }; | |
| export default function Data(state = initialState, action) { | |
| switch (action.type) { |
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
| clear() { | |
| const {editorState} = this.state | |
| const selection = editorState.getSelection() | |
| const contentState = editorState.getCurrentContent() | |
| const styles = editorState.getCurrentInlineStyle() | |
| const removeStyles = styles.reduce((state, style) => { | |
| return Modifier.removeInlineStyle(state, selection, style) }, contentState) | |
| const removeBlock = Modifier.setBlockType(removeStyles, selection, 'unstyled') |
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 React, {PropTypes} from 'react'; | |
| import {Editor, AtomicBlockUtils, Entity, EditorState, Modifier, RichUtils, convertToRaw} from 'draft-js' | |
| import isClient from 'check-client' | |
| const colorStyleMap = { | |
| red: { | |
| color: 'rgba(255, 0, 0, 1.0)', | |
| }, | |
| blue: { | |
| color: 'rgba(0, 0, 255, 1.0)', |
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 style = { | |
| transform: `translate(${index*2}px, 0 )`, | |
| transform: `rotate(${index*2}px, 0 )`, | |
| boxShadow:`1px 1px 1px 2px ${index}px` | |
| }; | |
| return <section key={index} id="card-container" style={style}> | |
| <div id="card"> | |
| <p>{card}</p> | |
| </div> | |
| </section> |
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
| server { | |
| listen 443 ssl; | |
| server_name url.pw www.url.pw; | |
| ssl_certificate /etc/letsencrypt/live/scarystories.pw/fullchain.pem; | |
| ssl_certificate_key /etc/letsencrypt/live/scarystories.pw/privkey.pem; | |
| ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
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 names = ['Mike', 'Matt', 'Nancy', 'Adam', 'Jenny', 'Nancy', 'Carl'] | |
| const count = names => | |
| names.reduce((a, b) => | |
| Object.assign(a, {[b]: (a[b] || 0) + 1}), {}) | |
| const duplicates = dict => | |
| Object.keys(dict).filter((a) => dict[a] > 1) | |
| console.log(count(names)) // { Mike: 1, Matt: 1, Nancy: 2, Adam: 1, Jenny: 1, Carl: 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
| #![allow(dead_code)] | |
| struct Car { | |
| name: String, | |
| seats: i32, | |
| speed: i32, | |
| } | |
| impl Car { | |
| fn drive(&self) { | |
| println!("{name} drives at speed: {speed} km/h", speed = self.speed, name = self.name); |
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 xml.etree.ElementTree | |
| ''' | |
| Classifier - array layout: | |
| [width, height, threshold, num_simple_classifiers, tilted, num_features, f1, f2, f3, f4, f_weight, simple_threshold, left_val, right, val, ...] | |
| ''' | |
| wrapper = "(function(module) {\n" + \ | |
| " \"use strict\";\n" + \ | |
| " \n" + \ |
OlderNewer