Skip to content

Instantly share code, notes, and snippets.

/*
#########
Notes:
#########
- $scope.saleschart is the chart object passed to the directive.
- $scope.saleschart.data is and instance of google.visualization.DataTable, giving it access to that class's member functions.
I also discovered that being an instance of the Chart API class allows access to the functions, but results in and field or
property being obfuscated. Calling .toJSON() gives a JSON object of the DataTable, which helps in debugging... but I just
don't trust any names other than functions.
- $scope.saleschart.view.columns starts as an array like [0,1,2,3,4,5]. Having fewer values than the number of columns would
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});
});
});
}
}]);
// simpler, faster, version that will throw a TypeError if the path is invalid
// by yorick
function extract(obj, key){
return key.split('.').reduce(function(p, c) {return p[c]}, obj)
}
extract
// for example:
var e = ['5+3','9+1','8+6','4+4','7+3'];e.forEach(function(eq){v=eq.split('+');a=parseInt(v[0])+parseInt(v[1]);b=parseInt(v[0])*parseInt(v[1]);console.log(b.toString()+a.toString())}) I put
@c0debreaker
c0debreaker / SassMeister-input-HTML.html
Created April 23, 2015 20:31
Generated by SassMeister.com.
<div class="sidebar">
<a id="button1" class="button">
<div class="text-center">
<i class="show-for-large-up fi-page-add icon-36"></i>
<p>Button 1 Button 1 Button 1</p>
</div>
</a>
<a id="button2" class="button">
<div class="text-center">
<i class="show-for-large-up fi-page-edit icon-36"></i>
<!doctype html>
<html>
<head>
<title> Learn to Code Securely – Code Example </title>
<style>
div#mp3_player {
width: 500px;
height: 60px;
background: #000;
@c0debreaker
c0debreaker / nginx.conf
Created September 22, 2016 04:06 — forked from mtigas/nginx.conf
Nginx configuration for securedrop.propublica.org. (Based on Ubuntu 13.10 / Nginx 1.4.1 default config.)
# This configuration file is provided on an "as is" basis,
# with no warranties or representations, and any use of it
# is at the user's own risk.
#
# You will need to edit domain name information, IP addresses for
# redirection (at the bottom), SSL certificate and key paths, and
# the "Public-Key-Pins" header. Search for any instance of "TODO".
user www-data;
worker_processes 4;
@c0debreaker
c0debreaker / PromiseAll.js
Last active February 17, 2017 17:46 — forked from ihgrant/example.js
GET a bunch of stuff and swallow failures
const getAndIgnoreFail = (fn) => {
return fn.catch(err => []);
};
Promise.all([
getAndIgnoreFail(axios.get('whatever')),
getAndIgnoreFail(axios.get('whatever2')),
getAndIgnoreFail(axios.get('whatever3')),
...
]).then(([whatever1, whatever2, whatever3, ...]) => {
@c0debreaker
c0debreaker / rtl_sdr, multimon-ng and kalibrate-rtl RPi Installer
Created January 19, 2018 06:14 — forked from iNem0o/rtl_sdr, multimon-ng and kalibrate-rtl RPi Installer
Installer script for rtl_sdr, multimon-ng and kalibrate-rtl on raspberry pi  
#!/bin/sh
# install :
# curl -o installer.sh https://gist.github.com/iNem0o/6346423/raw && chmod +x installer.sh && sudo ./installer.sh
sudo apt-get update
sudo apt-get --no-install-recommends -y install git cmake libusb-1.0-0-dev libpulse-dev libx11-dev screen qt4-qmake libtool autoconf automake libfftw3-dev
mkdir ~/src
echo "Installation de rtl_sdr"
@c0debreaker
c0debreaker / goesrecv.conf
Created May 26, 2018 03:06
Goes Satellite Configuration
[demodulator]
# mode = "lrit"
mode = "hrit"
source = "airspy"
# The section below configures the sample source to use.
#
# You can leave them commented out to use the default values for the
# demodulator mode you choose ("lrit" or "hrit"). To use and configure
# any of them, uncomment the section below, and change the demodulator