View gist:f9749d94670bbb351f4d
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
<?php | |
namespace App\Controller; | |
use App\Controller\AppController; | |
use Goutte\Client; | |
class TestController extends ScraperController { | |
public function add_products() |
View gist:3a3ac59351d6a2503ca5
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
try { | |
$savedNode = $nodesTable->save($node); | |
} catch(Exception $e) { | |
debug($e); | |
} |
View gist:519247
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<link rel="stylesheet" href="style.css" /> | |
<title>Pley: Patt's Badminton Court</title> | |
<!-- CSS --> | |
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen, projection"> | |
View tolerance
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
tolerance = abs(float(tolerance)) | |
if(tolerance > 0): | |
#get the difference of every bearing change | |
#if difference is within tolerance, print | |
#otherwise, ignore | |
diff = float(previous_bearing) - float(bearing) | |
#print abs(diff),tolerance | |
if(float(previous_bearing) != float(bearing)): | |
if(abs(diff) <= tolerance): |
View gist:718969
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
@login_required | |
def download(request,groupname,filename): | |
""" | |
Download a file | |
""" | |
custgroup = Group.objects.get(name=groupname) | |
if custgroup not in request.user.groups.all(): | |
return render_to_response('404.html') | |
else: | |
pass |
View urlopen in python
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
#example2.py | |
import cStringIO # *much* faster than StringIO | |
import urllib | |
import Image | |
file = | |
urllib.urlopen('http://freegee.sourceforge.net/FG_EN/src/teasers_en/t_gee-power_en.gif') | |
im = cStringIO.StringIO(file.read()) # constructs a StringIO holding the image | |
img = Image.open(im) |
View Python convert a datetime to seconds from epoch
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
int(time.mktime(time.strptime(str(image.uploaded_on), '%Y-%m-%d %H:%M:%S'))) |
View category under group.py
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 django.db import models | |
from datetime import datetime | |
from django.contrib.auth.models import Group, User | |
class Category(models.Model): | |
""" | |
class Car(models.Model): | |
company_that_makes_it = models.ForeignKey(Manufacturer) | |
# ... | |
""" |
View 2 ajax requests?
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
<div id="container"> | |
<input type="hidden" id="var" value="wenbert"/> | |
<input type="button" id="thebutton" value="Click"/> | |
</div> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$("#thebutton").click(function(){ | |
call_ajax1(); |
View in_cfai_not_in_123signup.sql
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
SELECT | |
cfai.display_name, cfai.first_name, cfai.last_name, cfai.email | |
FROM | |
from_cfai cfai | |
WHERE cfai.email NOT IN ( | |
SELECT onetwothree.email | |
FROM | |
from_123 onetwothree |
OlderNewer