This file contains 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 { default as request } from 'request' | |
const data = `...` | |
;(async () => { | |
// Make request | |
const result = await new Promise((resolve, reject) => { | |
request({ | |
url: '...', |
This file contains 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 { render } from "react-dom" | |
import { createStore } from "redux" | |
import { Provider, connect } from "react-redux" | |
import { mergeLeft } from "ramda"; | |
// Setup Redux store | |
const initialState = { count: 0, other: 3, something: 4 } | |
const reducer = (state = initialState) => mergeLeft({count: state.count + 1}, state) | |
const store = createStore(reducer) |
This file contains 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 chain = (...fns) => arg => fns.reduce((prev, fn) => fn(prev), arg) | |
const odds = array => array.filter(x => x % 2 === 0) | |
const double = array => array.map(x => x + x) | |
const result = chain(odds, double)([1,2,3,4,5,6,7,8]) | |
console.log(result) |
This file contains 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
create temp function MEDIAN(num_arr array<float64>) | |
returns float64 as ( | |
( select avg(num) | |
from ( | |
select | |
row_number() over (order by num) -1 as rn, | |
num | |
from unnest(num_arr) num | |
) | |
where |
This file contains 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
// https://dev-notes.eu/2018/06/http-server-in-c/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <netdb.h> | |
#include <arpa/inet.h> |
This file contains 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 SortedArray(...args) { return [...args].sort() } | |
SortedArray.prototype = Array.prototype | |
SortedArray.prototype.insert = function(item) { | |
function getLocation(item, start, end) { | |
// Get start, end, position | |
start = start || 0 | |
end = end || this.length | |
const p = parseInt(start + (end - start) / 2, 10) | |
// Finally return position |
This file contains 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
Create a folder with 2 files: | |
1. index.js | |
2. index.html | |
Then navigate to the root of the folder and start with this command: `node index.js` | |
===================================================== | |
This file contains 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 accountSid = '...'; // Your Account SID from www.twilio.com/console | |
var authToken = '...'; // Your Auth Token from www.twilio.com/console | |
var twilio = require('twilio'); | |
/** | |
* var client = new twilio.RestClient(accountSid, authToken); | |
* | |
* client.messages.create({ | |
* body: 'Hello from Node', | |
* to: '+12345678901', // Text this number |
This file contains 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
using System; | |
using Microsoft.VisualBasic.FileIO; | |
using System.IO; | |
namespace consoleTester | |
{ | |
public class Program | |
{ | |
private static readonly string filename = "sfcts_response_attach_data20180717.csv"; |
This file contains 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 fs = require('fs') | |
var CsvReadableStream = require('csv-reader') | |
const quotedRows = [8, 10] | |
var i = 0 | |
const redactQuestions = [ | |
"Home Phone:xxx-xxx-xxxx", | |
"Work Phone:xxx-xxx-xxxx", | |
"Cell Phone:xxx-xxx-xxxx", |