- Download and Install Sublime Text 3.1.1 Build 3176
- Install Package Control (don't forget to restart Sublime after)
- Install PackageResourceViewer (restart Sublime)
- Open the Command Palette (Tools > Command Palette from Sublime task menu)
- Enter open resource and select PackageResourceViewer: Open Resource
- Enter html and select HTML
- Enter sub and select HTML.sublime-syntax
- Click Find > Find... from the Sublime task menu (or use cmd+f or ctrl +f) and search for (?:java|ecma)
- Replace (?:java|ecma) on line 38 with (?:java|ecma|paper)
- Save and close the file
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
# My solution, using Typhoeus gem | |
p "-------Ian\'s Solution---------" | |
require 'typhoeus' | |
request = Typhoeus::Request.new("https://api.admoda.com/v1/advertiser/stats/campaigns.csv?date=2015-03-11", | |
method: :get, | |
headers: { 'Authorization' => 'Token api_token_here' }) | |
response = request.run | |
puts response.body |
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 _confidence(ups, downs) { | |
var n = ups + downs; | |
if(n === 0) { | |
return 0; | |
} | |
var z = 1.281551565545; | |
var p = parseFloat(ups) / n; | |
var left = p + 1 / (2 * n) * z * z; |
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
killall mongod | |
sudo apt-get purge -y mongodb-org* | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5 | |
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list | |
sudo apt-get update | |
sudo apt-get install -y mongodb-org | |
rm -rf mongod | |
echo "mongod --dbpath=data --nojournal" > mongod | |
chmod a+x mongod |
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
DROP DATABASE IF EXISTS ig_clone; | |
CREATE DATABASE ig_clone; | |
USE ig_clone; | |
CREATE TABLE users ( | |
id INTEGER AUTO_INCREMENT PRIMARY KEY, | |
username VARCHAR(255) UNIQUE NOT NULL, | |
created_at TIMESTAMP DEFAULT NOW() | |
); |
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
index: async (req, res, next) => { | |
let posts, filters, query; | |
// define escapeRegex function for search feature | |
const escapeRegex = (text) => { | |
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | |
}; | |
// check if filters exist | |
if (req.query.post) filters = Object.values(req.query.post).join('') ? true : false; | |
// check if request has filter(s) | |
if (filters) { |
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 shell = require('shelljs'); | |
const rp = require('request-promise'); | |
async function testWifi() { | |
let count = 0; | |
try { | |
const result = await rp('http://www.google.com'); | |
if (result) { | |
console.log('wifi working'); | |
} | |
} catch(err) { |
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
// FS docs: https://nodejs.org/api/fs.html | |
const fs = require('fs'); | |
fs.readdir('.', (err, files) => { | |
if(err) console.log(err); | |
let counter = 0; | |
files.forEach(file => { | |
// // match and delete thumbnails | |
// if(file.match(/\d\dx\d\d/) | |
// || file.match(/\d\d\dx\d\d\d/) |
OlderNewer