This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
title | |
file with a leading space = GIST title | |
http://stackoverflow.com/questions/19896900/how-to-change-the-name-of-a-gist-in-github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Chart = (function(window,d3) { | |
var svg, data, x, y, xAxis, yAxis, dim, chartWrapper, line, path, margin = {}, width, height, locator; | |
var breakPoint = 768; | |
d3.csv('data.csv', init); //load data, then initialize chart | |
//called once the data is loaded | |
function init(csv) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Simple Line Graph using SVG and d3.js</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
<style> | |
/* tell the SVG path to be a thin blue line without any area fill */ | |
path { | |
stroke: steelblue; | |
stroke-width: 1; | |
fill: none; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module App { | |
"use strict"; | |
//Method name should be exactly "response" - http://docs.angularjs.org/api/ng/service/$http | |
export interface IInterceptor { | |
request: Function; | |
requestError: Function; | |
response: Function; | |
responseError: Function; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROJECT_NAME=MyApp | |
SCHEME_NAME=MyApp | |
STARTTIME=$(date +%s); | |
set -e | |
set -x | |
### Install dependencies | |
echo "--- Install dependencies [Time Elapsed $(($(date +%s) - $STARTTIME))s]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app').controller('Control', function($scope) { | |
// data from form will go here | |
$scope.formModel = {}; | |
// field definition here - could also pull from server | |
$scope.fields = [ | |
{attr: 'firstName', label: 'First Name', required: true, type: 'text', required: true}, | |
{attr: 'lastName', label: 'Last Name', required: true, type: 'text'} | |
]; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smtp mail sending in cPython blocks the GIL. | |
This code is tested on python 2.7.8 and I'm using it with web2py | |
If you use Google Apps for your domain email and if you have admin access, you can easily use the gmail api. | |
Because you have admin access, you can create a "service account" in the Google Developer Console. | |
This makes authentication easy. | |
There are other authorisation methods when you don't have admin access, but they require interaction from the user via a browser. | |
To use this, you need to install these modules (From PyPI): | |
pyOpenSSL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" charset="utf-8" src="phonegap/cordova-1.6.0.js"></script> | |
<script id="sap-ui-bootstrap" | |
type="text/javascript" | |
src="sapui5/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_platinum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
A = [1, 8, -3, 0, 1, 3, -2, 4, 5] | |
def solution(K, A): | |
contenga = {} | |
for x in A: | |
if x not in contenga: | |
contenga[x] = 0 | |
contenga[x] += 1 |