Skip to content

Instantly share code, notes, and snippets.

View evert0n's full-sized avatar
:octocat:

Everton Yoshitani evert0n

:octocat:
View GitHub Profile
<?php
/*
* Benchmark validates csv file
*
*/
$file = 'csv-file-1000000-rows.csv';
$first_row_columns_names = true;
<?php
/*
* Benchmark checksum calculation `md5_file` vs unix `md5`
*
*/
$file = 'csv-file-1000000-rows.csv';
// Using `md5`
#!/bin/bash
#
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments.
# (initially aimed at php-files, but js should also work)
# Basically its a c-style comment -> markdown -> html converter
# Dependancies:
# - awk
# - sed
# - bash
# - php
var app = angular.module('app', ['ng']);
app.directive('myDirective', [
'$compile',
function ($compile) {
return {
replace: false,
terminal: true,
link: function ($scope, el$, attrs) {
var template, new$;
app.directive('ngFocus', ['$parse', function($parse) {
return function(scope, element, attr) {
var fn = $parse(attr['ngFocus']);
element.bind('focus', function(event) {
scope.$apply(function() {
fn(scope, {$event:event});
});
});
}
}]);
// node.js proxy server example for adding CORS headers to any existing http services.
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities
var httpProxy = require('http-proxy'),
express = require('express');
var proxy = new httpProxy.RoutingProxy();
var proxyOptions = {
host: '192.168.3.11',
@evert0n
evert0n / angular-color-contrast-demo.html
Last active January 2, 2016 02:39
AngularJS Color Contrast Directive Demo
<div class="container" ng-controller="demoCtrl">
<h2>Demo (AngularJS Issues Labels)</h2>
<div class="labels">
<a ng-repeat="label in labels" href="https://github.com/angular/angular.js/issues?labels={{label.name}}" target="_blank">
<span class="label" color-contrast="{{label.color}}">{{label.name}}</span></a>
</div>
</div>

You can import data as follows:

# Import a JSON document into table `users` in database `my_db`
$ rethinkdb import -c HOST:PORT -f user_data.json --table my_db.users

# Import a CSV document
$ rethinkdb import -c HOST:PORT -f user_data.csv --format csv --table my_db.users
#!/bin/bash
# nodejs - Startup script for node.js server
# chkconfig: 35 85 15
# description: node is an event-based web server.
# processname: node
# server: /path/to/your/node/file.js
# pidfile: /var/run/nodejs.pid
#
/*
Copyright (C) 2011 Colin Faulkingham, http://3a2d29.com/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of