Skip to content

Instantly share code, notes, and snippets.

@jgravois
jgravois / hub_v3_search_api_ref.md
Created February 5, 2019 19:37
Hub v3 Search API doc port (February 5th, 2019)
@hamhands
hamhands / v3.md
Last active January 30, 2024 20:52
@hagemann
hagemann / database.js
Last active December 9, 2022 10:24
Promisified MySQL middleware for Node.js
const util = require('util')
const mysql = require('mysql')
const pool = mysql.createPool({
connectionLimit: 10,
host: 'localhost',
user: 'root',
password: 'password',
database: 'my_database'
})
@mitrakmt
mitrakmt / stack.js
Created September 19, 2016 03:27
Stack Data Structure in JavaScript
// This Stack is written using the pseudoclassical pattern
// Creates a stack
var Stack = function() {
this.count = 0;
this.storage = {};
}
// Adds a value onto the end of the stack
Stack.prototype.push = function(value) {
## How to hide API keys from github ##
1. If you have already pushed commits with sensitive data, follow this guide to remove the sensitive info while
retaining your commits: https://help.github.com/articles/remove-sensitive-data/
2. In the terminal, create a config.js file and open it up:
touch config.js
atom config.js
@alonronin
alonronin / recurssive.tree.js
Last active August 26, 2023 09:23
Create recursive tree from json using lodash transform without recursion. Can have unlimited nesting.
var _ = require('lodash');
var arr = [
{"name":"my2child1","title":"My 2 Child 1","parent":"my2"},
{"name":"my2child2","title":"My 2 Child 2","parent":"my2"},
{"name":"parent","title":"A single parent"},
{"name":"child-parent","title":"A child parent","parent":"child1"},
{"name":"my","title":"My"},
{"name":"my2","title":"My2"},
{"name":"child1","title":"Child 1","parent":"my"},
@Miserlou
Miserlou / gist:11500b2345d3fe850c92
Created April 27, 2015 21:20
1000 Largest US Cities By Population
Largest 1000 Cities in America
2013 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2013 growth
1,New York,New York,8405837,4.8%
2,Los Angeles,California,3884307,4.8%
3,Chicago,Illinois,2718782,-6.1%
4,Houston,Texas,2195914,11.0%
5,Philadelphia,Pennsylvania,1553165,2.6%
@akozlik
akozlik / gist:11241740
Created April 24, 2014 04:42
Zoom MapKit out to fit pins
-(void)zoomToFitMapAnnotations:(MKMapView*)mapView
{
if([mapView.annotations count] == 0)
return;
CLLocationCoordinate2D topLeftCoord;
topLeftCoord.latitude = -90;
topLeftCoord.longitude = 180;
CLLocationCoordinate2D bottomRightCoord;
@MrSaints
MrSaints / angular_data.html
Last active October 19, 2022 09:42
A simple AngularJS application to add / delete / list / sort data comprising of three fields (state code, price and tax). It was written to demonstrate to a friend, the simplicity and power of Angular to address programming challenges - in recruitment processes - quickly and effectively.
<!DOCTYPE html>
<html ng-app>
<head>
<title>Add / List Data (AngularJS)</title>
<style>
.list_data { margin-bottom: 2rem }
table, th, td { border: 1px solid #AAA }
th { cursor: pointer }
</style>
</head>
@lovasoa
lovasoa / node-walk.es6
Last active March 12, 2024 09:40
Walk through a directory recursively in node.js.
// ES6 version using asynchronous iterators, compatible with node v10.0+
const fs = require("fs");
const path = require("path");
async function* walk(dir) {
for await (const d of await fs.promises.opendir(dir)) {
const entry = path.join(dir, d.name);
if (d.isDirectory()) yield* walk(entry);
else if (d.isFile()) yield entry;