Skip to content

Instantly share code, notes, and snippets.

View medelling24's full-sized avatar

Luis Medellin medelling24

  • Fresnel
  • Calgary, AB
View GitHub Profile
## problem 1
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('mycorp');
$id = $_GET['id'];
$query = "SELECT subject, body FROM newsletters WHERE id=". $id;
$response = mysql_query($query);
@medelling24
medelling24 / arrayflatten.js
Created August 23, 2016 22:04
flatten an array of arbitrarily nested arrays of integers into a flat array of integers
// [[1,2,[3]],4]
var arr = arrayFlatten([[1,2,[3]],4,[1,[2,[3]]]]);
console.log(arr);
//Main function
function arrayFlatten(obj){
var flattenArray=[];
//Call recursive funcion sending the array as "reference"
flatten(obj,flattenArray);