Skip to content

Instantly share code, notes, and snippets.

@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;
<!doctype html>
<html>
<head>
<title> Learn to Code Securely – Code Example </title>
<style>
div#mp3_player {
width: 500px;
height: 60px;
background: #000;
@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>
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
// 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:
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});
});
});
}
}]);
/*
#########
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
@c0debreaker
c0debreaker / gist:335c4d0c1155c517a441
Created May 15, 2014 13:46
5 column hack for Bootstrap
.col-xs-15,
.col-sm-15,
.col-md-15,
.col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
// This code uses the SoftwareSerial library.
// It can be obtained here: http://arduino.cc/en/Reference/SoftwareSerial
unsigned int timeout=0;
unsigned char state=0;
char val; // variable to receive data from the serial port
int ledpin = 13; // LED connected to pin 13
// Timer2 service
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#