Skip to content

Instantly share code, notes, and snippets.

View ispyhumanfly's full-sized avatar

Dan Stephenson ispyhumanfly

View GitHub Profile
@ispyhumanfly
ispyhumanfly / gist:2155468
Created March 22, 2012 03:41
The issue I'm having with DateTime object queries.
# Networking
my $dtf = $MODEL->storage->datetime_parser;
my $start_period = DateTime->now;
my $end_period = $start_period->add(months => 3, days => 1);
my @networking = $MODEL->resultset('Content')->search(
{ types => {like => '%event%'},
tags => {like => '%networking%'},
start_datetime => {
### After 5 REST API
get '/rest/get/:amount/:sort/:results' =>
[amount => qr/\w+/, sort => qr/\w+/, results => qr/\w+\.json/] => sub {
my $self = shift;
my $json = Mojo::JSON->new;
my (%query, %sorting);
''' Appname Template '''
if re.match('.*APPNAME_TEMPLATE EXISTS', line):
if os.path.exists('%s/templates/app-inp-%s.xml' % (app_config, app_name)):
appname_template = open('%s/templates/app-inp-%s.xml' % (app_config, app_name), 'r')
for template_line in appname_template.readlines():
if enabled is True:
@ispyhumanfly
ispyhumanfly / gist:19043d340d78385ea624
Created November 13, 2014 21:48
Example of using Mojo's upload handling...
if ($self->req->upload('photos')) {
push @photos,
process_photo($self->req->upload('photos'), $new_content->id);
$MODEL->resultset('Content')->search({id => $new_content->id})
->update({photos => "@photos"})
if scalar @photos >= 1;
}
root@ip-10-0-238-38:/home/ubuntu# x84
Traceback (most recent call last):
File "/usr/local/bin/x84", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 444, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
@ispyhumanfly
ispyhumanfly / input.storage.json
Last active December 1, 2016 05:47
An example of storing KPI data in a object store.
"objects": [
{
"kpis": [
{
"2016": {
"plants": [
{
"warren": {
@ispyhumanfly
ispyhumanfly / jquery-delayedautoscroll.js
Last active December 29, 2016 01:14
jquery-delayedautoscroll
setTimeout(function() {
$("html, body").animate({
scrollTop: 848
}, 1000)
}, 4000)
#!/usr/bin/env php
<?php
require './simple_html_dom.php';
$html = file_get_html('https://www.bleulibellule.com/');
/* Links */
<?php
//namespace simplehtmldom_1_5;
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
* Contributions by:
* Yousuke Kumakura (Attribute filters)
* Vadim Voituk (Negative indexes supports of "find" method)
#!/usr/bin/env php
<?php
require './simple_html_dom.php';
/* Bleu Libellue */
$html = file_get_html('https://www.bleulibellule.com/');