This file contains hidden or 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 sys | |
spinner = cycle(['|', '/', '-', '\\']) | |
while SOMETHING_IN_PROGRESS: | |
sys.stdout.write(f"\r{' ' * 50}\r") # Clear the line | |
sys.stdout.write(f"{next(spinner)} Status: {status}") | |
sys.stdout.flush() | |
time.sleep(1) |
This file contains hidden or 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 ray | |
from ray import workflow | |
from typing import List | |
@workflow.step | |
def read_data(num: int): | |
return [i for i in range(num)] | |
@workflow.step | |
def preprocessing(data: List[float]) -> List[float]: |
This file contains hidden or 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
$(".draggable").on("dragstart", function (e) { | |
var url = "application/octet-stream:" + your_file_title + ":" + your_file_url_on_server; | |
e.dataTransfer.setData("DownloadURL", url); | |
}); |
This file contains hidden or 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 form = $("<form></form>"); | |
form.append("<label>Title:</label> <input type=text name='title' />"); | |
form.append("<label>Description:</label> <textarea name='description'></textarea>"); | |
bootbox.form("Project settings", form, function($form) { | |
if (!$form) return; | |
var settings = {}; |
This file contains hidden or 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
bootbox.upload("Choose file", "/file_upload/", function($form) { | |
if (!$form) return; | |
var form_data = new FormData(); | |
form_data.append("file", $form.find("input[type='file']")[0].files[0]); | |
$.ajax({ | |
url: $form.attr("action"), | |
processData: false, // Important! | |
contentType: false, // Important! |
This file contains hidden or 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 bottle import * | |
from bottlepy_user_auth import User | |
def validate_login(): | |
return User().loggedin | |
def login_required(view, check_func=validate_login): | |
''' |
This file contains hidden or 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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script> | |
<script type='text/javascript' src='https://cdn.firebase.com/v0/firebase.js'></script> | |
<script src="firebase-models.js"></script> | |
<script> | |
var Chat = {}; | |
$.extend(Chat, FirebaseModels.Model, { | |
type: "Chat", | |
firebase: new Firebase("https://blabla.firebaseio-demo.com/Chat/") | |
}); | |
This file contains hidden or 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 os | |
import webapp2 | |
from base import admin_required, BaseHandler | |
# import your models here, required for eval() | |
actions_map = { | |
"c": "Add", | |
"r": "List", | |
"u": "Edit", |
This file contains hidden or 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> | |
<link rel="stylesheet" type="text/css" href="https://cdn.widget.dev.odeskps.com/static/default_widget_look.css" /> | |
<script src="https://cdn.widget.dev.odeskps.com/static/js/jquery.min.js"></script> | |
<script src="https://cdn.widget.dev.odeskps.com/static/widget-app.js"></script> | |
<script> | |
(new WidgetsProducerBase()).contractors({ | |
'q': 'python', | |
'id': 'odesk-widget', | |
'perPage': 5 | |
}); |
This file contains hidden or 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
display.setStatusBar( display.DefaultStatusBar ) | |
local widget = require "widget" | |
local sbHeight = display.statusBarHeight | |
local tbHeight = 44 | |
local top = sbHeight + tbHeight | |
-- forward declarations | |
local titleField, noteText, loadSavedNote, saveNote |
NewerOlder