Skip to content

Instantly share code, notes, and snippets.

There's a script you can run that divides an audio clip into small segments.
The following code splits an mpeg into optionally overlapping snippets of audio for transcription or whatever...
#NOTE! you must install ffmpeg in your system first (http://ffmpeg.org/download.html): $brew install FFmpeg
overlap = XX #overlap between snippets in seconds
total_length = XX #total length of file in seconds
step_size = XX #length of snippets in seconds
file_path = "" #path to audio file
curl https://api.crowdflower.com/v1/jobs/425038/units/448518368.json?key=KEY
{"agreement":1.0,"missed_count":0,"results":{"item_price":{"agg":null,"confidence":0},"price":{"agg":"","confidence":1.0},"discount":{"agg":"","confidence":1.0},"include_yn":{"agg":"","confidence":1.0},"judgments":[{"reviewed":null,"worker_id":26078288,"unit_state":"finalized","golden":false,"started_at":"2014-04-17T20:28:13+00:00","created_at":"2014-04-17T20:29:32+00:00","data":{"item_price":"$7.49","item_quantity":"1"},"job_id":425038,"tainted":false,"rejected":null,"judgment":1,"unit_data":{"unit_type":"item_unit","filename":"http://karasic.com/crowdflower/Costco-001.jpg","upc":"805573"},"worker_trust":1.0,"unit_id":448518368,"region":"MA","external_type":"cf_internal","country":"USA","webhook_sent_at":null,"id":1245319265,"trust":1.0,"city":"Lexington","missed":null}],"discount_price":{"agg":"","confidence":1.0},"quantity":{"agg":"","confidence":1.0},"item_quantity":{"agg":null,"confidence":0},"not_readable":{"agg":"","confidence
when I use the /jobs/{job_id}/units/{unit_id} endpoint to create or update a unit to add gold, I am having trouble specifying more than one answer 2:09
the whole array ends up quoted
or should I just repeat unit[data][field_golden]=x&unit[data][field_golden]=y to give both answers?
I have been doing unit[data][field_golden]=[x,y] 2:10
Wil Stevens sure - I know we separate them by a newline character 2:11
which is often /n
Christopher Hundt you mean unit[data][field_golden]=[x\ny] ?
or rather unit[data][field_golden]=x\ny?
Wil Stevens the latter 2:13
Christopher Hundt that did not seem to work 2:15
I'm using curl on PHP the request parameters are these:
$defaults = array(
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => count($data),
CURLOPT_POSTFIELDS=> json_encode($data, JSON_FORCE_OBJECT),
CURLOPT_HEADER => 0,
CURLOPT_URL => $this->url.$uri.'.json?key='.$this->key,
CURLOPT_FRESH_CONNECT => 1,
<cml:group only-if="able_to_classify:[Yes]">
<cml:select label="Please choose the best classification for the company from the following choices:" id="drop" name="drop">
<cml:option label="Please select one of the following choices..." />
<cml:option label="*****MOST COMMON CLASSIFICATIONS*****" />
<cml:option label="Investment Advisor" />
<cml:option label="Corporation" />
<cml:option label="Hedge Fund Manager" />
<cml:option label="Bank" />
<cml:option label="Government" />
a.clean {
color:#00a6e0;
text-decoration:underline;
font-size: 20pt;
line-height: 18pt;
font-weight: 900;
}
a.clean:link { color:#00a6e0;
text-decoration:underline;
font-size: 20pt;
@WilCF
WilCF / gist:e97fbb93306e092db98a
Created May 26, 2015 14:10
Only If Not Empty Liquid
<cml:radios name="category" label="Choose the best category for this product:" validates="required">
<cml:radio label="{{pt_1}}" value="{{pt_1}}" />
{% if pt_2 != '' and pt_2 != 'No data available' and pt_2 != empty %}
<cml:radio label="{{pt_2}}" value="{{pt_2}}" />
{% endif %}
{% if pt_3 != '' and pt_3 != 'No data available' and pt_3 != empty %}
<cml:radio label="{{pt_3}}" value="{{pt_3}}" />
{% endif %}
{% if pt_4 != '' and pt_4 != 'No data available' and pt_4 != empty %}
<cml:radio label="{{pt_4}}" value="{{pt_4}}" />
@WilCF
WilCF / gist:1dd5a76558a1c5358f41
Created May 26, 2015 21:00
JQuery to disallow similar textbox input submissions
require(['jquery-noconflict'], function(jQuery) {
//Ensure MooTools is where it must be
Window.implement('$', function(el, nc){
return document.id(el, nc, this.document);
});
var $ = window.jQuery;
$(document).ready(function(){
$("input.submit").click(function(e){
var bad_answers = false;
$(".cml.jsawesome").each(function() {
<!-- The 'cml:select' tag is in regards to a dropdown list, where each dropdown option is a subtag labeled 'cml:option'. -->
<cml:select label="What type of room is this a part of?" name="room_type" instructions="Remember, use the image name as reference and verify the correct room type on the hotel website." only-if="hotel:[1]++notonlist:unchecked" gold="true">
<cml:option label="CF room" value="bad"></cml:option>
<!-- A Liquid for Designers for loop is used here to create each room type option from the choices list. 'item' is an arbritrary value for the for loop, but it must match the cml:option label. The value of this cml:option is also a Liquid value that inputs the corresponding value of an 'item' in the 'choices' array by calling the 'item's index number -->
{% for item in choices %}
<cml:option label="{{item}}" value="{{choices[forloop.index0]}}"></cml:option>
{% endfor %}
</cml:select>
Issue:
User has a FINISHED state job that has “"It seems like you've put input fields in your job that have the same names as headers in data you originally uploaded: tweet_id, handle. Please give the input fields in your job new names to avoid this problem.” error.
Expected: Despite error, I would be able to download the results for my job - I would expect I would not be able to relaunch the job.
Who does this affect?
Crowd reason - dozens of jobs
WCG - a few jobs
Apple - a few jobs
A handful of other customers who have written in.