Skip to content

Instantly share code, notes, and snippets.

View rebase-master's full-sized avatar
🚂
Diving into Rails 7

Mansoor Khan rebase-master

🚂
Diving into Rails 7
View GitHub Profile
import { Component, OnInit, OnChanges, ViewChild, ElementRef, Input } from '@angular/core';
import {D3Service, D3, Selection} from 'd3-ng2-service';
@Component({
selector: 'app-chart',
templateUrl: '.chart.component.html',
styleUrls: ['./chart.component.scss']
})
export class ChartComponent implements OnInit, OnChanges {
@rebase-master
rebase-master / flatten.js
Created November 20, 2016 05:27
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
function flatten() {
var flat = [];
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] instanceof Array) {
flat.push.apply(flat, flatten.apply(this, arguments[i]));
} else {
flat.push(arguments[i]);
}
}
return flat;
@rebase-master
rebase-master / Installing C++ compilers for Python 2.7 libraries
Created April 14, 2014 09:27
Installing C++ compilers for Python 2.7 libraries
If you encounter errors like, "unable to find vcvarsall.bat" when installing Python dependencies,
you are probably missing C++ compilers needed to compile python libraries. To fix this issue,
install Micsrosoft Visual C++ 2008 redistributable 64 bit.
Building on the solution provided here: http://stackoverflow.com/a/18045219/888278
Download specifically the Windows SDK for Windows 7 and .NET Framework 3.5 SP1 which gives you a x64 compiler for VC++ 2008 (VC++ 9.0) if you need it.
Note: If you have both a 32- and 64-bit Python installation, you may also want to use virtualenv to create separate Python environments to use one or the other at a time without messing with your path to choose which Python version to use.
Setting up PHP extensions php_curl and php_apc on windows 7.
If you're using windows 64-bit OS, download the 64-bit TS VC9 compiled DLL files i.e. php_apc.dll
and php_curl.dll, and store them in the PHP extensions directory. Now, enable these extensions
in the PHP config file i.e. php.ini and you're good to go.
If you're using WAMP, the extension directory can be found in the C:\wamp\bin\php\php<version>\ext.
If all went well, you can see the APC and CURL extensions in the phpinfo page.
To check PHP configuration settings on the server, create the following file, name
it phpinfo.php and save it in c:\wamp\www folder.