Skip to content

Instantly share code, notes, and snippets.

JSON.parse

Ryan Wuster ryanhanwu

JSON.parse
View GitHub Profile
View inArray.asp
<%
Function InArray(Needle, Haystack)
Dim i, x
InArray = False
For i = 0 To Ubound(Haystack)
If IsArray(Needle) = True Then
For x = 0 To Ubound(Needle)
If Trim(Haystack(i)) = Trim(Needle(x)) Then
InArray = True
View test.sh
aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[].Size), length(Contents[])]"
View filepreview.js
/*
filepreview : A file preview generator for node.js
*/
var child_process = require('child_process');
var crypto = require('crypto');
var async = require('async');
var path = require('path');
View append.js
fs.appendFile('message.txt', 'data to append', function (err) {
if (err) throw err;
console.log('Saved!');
});
@ryanhanwu
ryanhanwu / parsekeyword.js
Last active Oct 25, 2018
Parse Double Quote #Search
View parsekeyword.js
module.exports= function parseKeywords(req, res, next){
const { q } = res.locals
//extract double quote terms
const re = /"(.*?)"/g
const phrases = []
let current
while ((current = re.exec(q))) {
phrases.push(current.pop())
}
//replace -_. with space for matches
@ryanhanwu
ryanhanwu / docker_est.sh
Last active Jan 16, 2020
Set #docker timezone to EST
View docker_est.sh
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
@ryanhanwu
ryanhanwu / the-scratch.conf
Created May 4, 2018 — forked from korczis/the-scratch.conf
Nginx Node.js Proxy with caching, websockets, gzip
View the-scratch.conf
proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
# the IP(s) on which your node server is running. I chose port 3000.
upstream app_the_scratch {
server 127.0.0.1:3000 weight=1 fail_timeout=60s;
}
# the nginx server instance
server {
@ryanhanwu
ryanhanwu / dynamoScanPromise.js
Created Apr 26, 2017
A short snippet for scanning AWS DynamoDB table with AWS SDK and Promise
View dynamoScanPromise.js
var params = {
TableName: 'MYTABLE',
FilterExpression: 'contains (myKey , :query)',
ExpressionAttributeValues: {
':query': query
}
}
var dynamoScan = new Promise(function(resolve, reject) {
var results = []
View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@ryanhanwu
ryanhanwu / The Technical Interview Cheat Sheet.md
Created Jan 29, 2017 — forked from TSiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.
View The Technical Interview Cheat Sheet.md

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
You can’t perform that action at this time.