# Turn off your Vagrant machine
$ vagrant halt
# Comment out this line in Vagrantfile
# config.disksize.size = '30GB'
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 _set_files(files): | |
if current.request.ajax: | |
current.response.js = (current.response.js or '') + """;(function ($) { | |
var srcs = $('script').map(function(){return $(this).attr('src');}), | |
hrefs = $('link').map(function(){return $(this).attr('href');}); | |
$.each(%s, function() { | |
if ((this.slice(-3) == '.js') && ($.inArray(this.toString(), srcs) == -1)) { | |
var el = document.createElement('script'); el.type = 'text/javascript'; el.src = this; | |
document.body.appendChild(el); | |
} else if ((this.slice(-4) == '.css') && ($.inArray(this.toString(), hrefs) == -1)) { |
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
script = SCRIPT(""" | |
jQuery(function() { var t = 10; (function run() {if ((function() { | |
var el = jQuery("#%(id)s"); | |
if (el.AnyTime_picker == undefined) { return true; } | |
el.AnyTime_noPicker().AnyTime_picker( | |
jQuery.extend({format: "%%Y-%%m-%%d", labelTitle: "%(title)s"}, | |
%(date_option)s)); | |
})()) {setTimeout(run, t); t = 2*t;}})();}); | |
""" % dict(id=_id, title=current.T('Choose date'), | |
date_option=_get_date_option())) |
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 descendants_from_node(self, node, include_self=False): | |
db, table_node = self.db, self.settings.table_node | |
node = self._load_node(node) | |
left, right = node.left, node.right | |
if include_self: | |
left -= 1 | |
right += 1 | |
return db(table_node.left > left)(table_node.right < right)( |
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
--- a/modules/plugin_lazy_options_widget.py | |
+++ b/modules/plugin_lazy_options_widget.py | |
@@ -37,6 +37,9 @@ class lazy_options_widget(SQLFORM.widgets.options): | |
self.keyword = self.keyword % dict(fieldname=field.name) | |
requires = field.requires | |
+ | |
+ if isinstance(requires, IS_EMPTY_OR): | |
+ requires = requires.other | |
if not isinstance(requires, (list, tuple)): |
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
NSMutableArray *tasks = [[NSMutableArray alloc] init]; | |
[tasks addObject: ^() { | |
NSLog(@"task1"); | |
}]; | |
[tasks addObject: ^() { | |
NSLog(@"task2"); | |
}]; | |
for (void (^task)() in tasks) { | |
task(); | |
} |
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
NSMutableArray *tasks = [[NSMutableArray alloc] init]; | |
void (^nextTask)() = ^() { | |
[tasks removeObjectAtIndex: 0]; | |
if ([tasks count] > 0) { | |
void (^task)() = [tasks objectAtIndex: 0]; | |
task(); | |
} | |
}; | |
[tasks addObject: ^() { | |
NSLog(@"task1"); |
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
dispatch_queue_t trail_queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); | |
dispatch_group_t trail_group = dispatch_group_create(); | |
NSMutableArray *tasks = [[NSMutableArray alloc] init]; | |
void (^nextTask)() = ^() { | |
[tasks removeObjectAtIndex: 0]; | |
if ([tasks count] > 0) { | |
void (^task)() = [tasks objectAtIndex: 0]; | |
task(); | |
} else { |
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
////////////////////////////////////////////////////// | |
// In SamplePage.xaml | |
////////////////////////////////////////////////////// | |
<local:Breadcrumbs Height="25" MaxWidth="475" | |
ItemsSource="{Binding Source={StaticResource sampleBreadcrumbsViewSource}}" | |
> | |
<local:Breadcrumbs.ItemTemplate> | |
<DataTemplate> | |
<Button VerticalAlignment="Top" Margin="0,0,5,0" |
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
# Define ULID_DECODE and ULID_ENCODE which convert a ulid string to a binary and vice versa. | |
delimiter // | |
DROP FUNCTION IF EXISTS ULID_DECODE// | |
CREATE FUNCTION ULID_DECODE (s CHAR(26)) RETURNS BINARY(16) DETERMINISTIC | |
BEGIN | |
DECLARE s_base32 CHAR(26); | |
SET s_base32 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(UPPER(s), 'J', 'I'), 'K', 'J'), 'M', 'K'), 'N', 'L'), 'P', 'M'), 'Q', 'N'), 'R', 'O'), 'S', 'P'), 'T', 'Q'), 'V', 'R'), 'W', 'S'), 'X', 'T'), 'Y', 'U'), 'Z', 'V'); | |
RETURN UNHEX(CONCAT(LPAD(CONV(SUBSTRING(s_base32, 1, 2), 32, 16), 2, '0'), LPAD(CONV(SUBSTRING(s_base32, 3, 12), 32, 16), 15, '0'), LPAD(CONV(SUBSTRING(s_base32, 15, 12), 32, 16), 15, '0'))); | |
END// |
OlderNewer