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
import csv | |
def toMarkdown(item): | |
newTemp = "---"+"\n"+"layout: sculpture"+"\n"+"pageId: "+item[0]+"\n"+"uid: "+item[1]+"\n" | |
newTemp += "title: "+item[2]+"\n"+"location: "+item[3]+"\n"+"completionDate: "+item[4]+"\n" | |
newTemp += "description: "+item[5]+"\n"+"imageId: "+item[6]+"\n" | |
newTemp += "---"+"\n" | |
return newTemp | |
with open('file.csv', 'rb') as f: |
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
R.find(function(w) {return item[key] === w[key];}, collection); | |
R.find(function(w) {return item === w.id;}, collection); | |
function(key, collection, item) { | |
var found = _.find(collection, function(x) { | |
return x[key] === item[key]; | |
}); | |
return found; | |
} |
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 _deferredFetch = r.curry(function(response) { | |
var deferred = $q.defer(); | |
deferred.resolve(response); | |
return deferred.promise; | |
}); |
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
function fetchFromService(data) { | |
var promises = []; | |
_.each(data, function(item) { | |
var deferred = $q.defer(); | |
someService.getItem(item).then(function(response) { | |
deferred.resolve(response); | |
}); | |
promises.push(deferred.promise); | |
}); | |
return $q.all(promises); |
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('sceTrustfilter', []).filter('html_to_trust', ['$sce', function($sce){ | |
return function(text) { | |
return $sce.trustAsHtml(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
def makeSand(haspb, hasjelly, slicesofbread): | |
breadneeded = 2.0 | |
if haspb == True: #have peanut butter | |
numofsand = slicesofbread/breadneeded #calculate number of sandwich I can make from bread | |
sandtype = "peanut butter" #set default sandwich type | |
if hasjelly == True: #have jelly too | |
sandtype = "peanut butter and jelly" #set sandwich type to include jelly | |
#start counting number of sandwiches I can make |
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
//from this post http://bucketpress.com/next-and-previous-post-link-in-same-custom-taxonomy | |
// get_posts in same custom taxonomy | |
$postlist_args = array( | |
'posts_per_page' => -1, | |
'orderby' => 'menu_order title', | |
'order' => 'ASC', | |
'post_type' => 'your_custom_post_type', | |
'your_custom_taxonomy' => 'your_custom_taxonomy_term' | |
); | |
$postlist = get_posts( $postlist_args ); |
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
.bubble { | |
position:relative; | |
padding:10px; | |
margin:1em 0; | |
color:#000; | |
line-height: 1.65em; | |
font-weight: 500; | |
background:#EDE4A6; | |
-webkit-border-radius:10px; | |
-moz-border-radius:10px; |
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
jQuery(document).ready(function(){ | |
var dpost = jQuery('#calloutpos').offset().top; | |
jQuery('#bottomslide').click(function(){ | |
jQuery('html, body').animate({scrollTop:dpos}, 'slow'); | |
return false; | |
}); | |
}); |
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
function drawMap(id, ds) { | |
//load data | |
d3.csv(ds, function(data) { | |
var nodes = classes(data); | |
for (var i=0;i<1;i++){ | |
d3.select('#'+id) | |
.selectAll('#'+id+' li') |