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
export default class MainComponent extends React.Component { | |
_bind(...methods) { | |
methods.map((method) => { | |
this[method] = this[method].bind(this) | |
}); | |
} | |
} |
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 showMessage(){ | |
setTimeout(function(){ | |
alert("Hello the function() is an anonymous function."); | |
}, 3000); | |
} |
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 App extends MainComponent { | |
constructor() { | |
super(); | |
this.state = { | |
clicked: false | |
} | |
this._bind('doSomething') | |
} | |
doSomething() { | |
this.setState({clicked: true}); |
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
noodle.query({ | |
url: 'http://losangeles.craigslist.org/search/hhh', | |
type: 'html', | |
selector: 'span.pl a', | |
extract: 'href', | |
}).then(function(response) { | |
links = response.results[0].results | |
}) |
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 = { | |
entry: "./public/main.js", | |
output: { | |
filename: "public/bundle.js" | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js?$/, | |
exclude: /(node_modules|bower_components)/, |
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 passport = require('passport'); | |
var router = express.Router(); | |
var multer = require('multer'); | |
var upload = multer({dest: './images/'}) | |
// required models | |
var User = require('../models/User'); | |
var Photo = require('../models/Photo'); | |
var db = require('../models/db'); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Microsoft Graphs</title> | |
</head> | |
<body> | |
<div id="wrapper"> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.js" charset="utf-8"></script> |
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
require "rufus-scheduler" | |
require "watir-webdriver" | |
browser = Watir::Browser.new(:chrome) | |
edit_page = "" | |
browser.goto("#{edit_page}") | |
while true do | |
sleep(300) | |
browser.button(class: "button").click | |
puts "just updated your profile" |
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
page.search('.colmask')[0].children.search("ul > li > a").each do |a| a["href"].tr("/(^\/\/)(\w+)/", "").split(".").delete_if {|href| href == "craigslist" || href == "org"}.map {|link| links << link} end |
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
for(let {category: c} of videos) { | |
categories.push(c) | |
} | |
let uniqueCategories = [...new Set(categories)] |