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
module.exports = { | |
settings: { | |
runtime: { /* ... */ }, | |
build: { /* ... */ }, | |
}, | |
webpack: (target) => { | |
const settings = require('roc').getSettings(); | |
console.log(target); // web or node |
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
// Shortcode usage in the WYSIWYG: [iframe src="https://gist.github.com/bjarneo/65115610d02ac0dd77597464014bddfb"] | |
function iframe($atts) { | |
return sprintf( | |
'<iframe src="%s" />', | |
$atts['src'] | |
); | |
} | |
add_shortcode('iframe', 'iframe'); |
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
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi -f $(docker images -q) | |
# Delete all | |
docker rm -v $(docker ps -a -q -f status=exited) | |
docker rmi -f $(docker images -f "dangling=true" -q) |
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 events = {}; | |
function on(event, callback) { | |
if (!events[event]) { | |
events[event] = []; | |
} | |
events[event].push(callback); | |
} |
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
// Remove N documents from collection | |
var idsToRemove = db.collection.find({ "query": "to perform" }).limit(10000).sort({ "_id": -1 }).toArray().map(function(doc) { return doc._id; }); | |
db.collection.remove({ "_id": { $in: idsToRemove }}) | |
// Update | |
db.collection.update({ "_id": { $set: { "test": "update" } } }); | |
// Get current operations | |
db.currentOp(); |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import FeedList from './feed-list'; | |
class Feed extends React.Component { | |
render() { | |
return ( | |
<div className="feed-wrapper"> | |
<FeedList /> | |
</div> |
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
(function(){ | |
function getRandomColor() { | |
var letters = '0123456789ABCDEF'.split(''); | |
var color = '#'; | |
for (var i = 0; i < 6; i++ ) { | |
color += letters[Math.floor(Math.random() * 16)]; | |
} | |
return color; |
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 stop = new Date().getTime(); | |
while(new Date().getTime() < stop + 10000); |
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
Model + View | |
http://stackoverflow.com/a/5864000 | |
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
sudo chown -R $(whoami) ~/.npm |