Skip to content

Instantly share code, notes, and snippets.

@v
v / twitter_trends.py
Created April 22, 2012 02:39
Python Get trends
@v
v / test.py
Created May 27, 2012 05:10
PyQt Network Manager
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
from PyQt4.QtNetwork import *
import sys
class Render(QWebPage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebPage.__init__(self)
@v
v / TimeInterval
Created June 14, 2012 00:28
Cython Problems?
class TimeInterval(Feature):
""" A Time Interval represents a period of time in a given day. It does not understand dates or days of the week.
It understands no unit of time that it smaller than a minute."""
def __init__(self, start, end):
""" start and end are represented as minutes from midnight """
start = minutes_from_midnight(start)
end = minutes_from_midnight(end)
self.start = start
@v
v / level7.js
Created August 25, 2012 20:36
dont worry about it
$.ajax('user_info', {
success: function(response){
var result = $(response).find('td')[1].innerHTML;
var csrf = $('input[name="_csrf"]').val();
var data = {
title: 'ALL THEM PASSWORDZ',
body: encodeURIComponent(result),
_csrf: csrf
}
$.ajax('ajax/posts', {
@v
v / coffee.coffee
Created September 6, 2012 20:37
Sadness
{BrunchApplication} = require 'helpers'
{MainRouter} = require 'routers/main_router'
{HomeView} = require 'views/HomeView'
{LoginView} = require 'views/LoginView'
{EditView} = require 'views/EditView'
{NavigationView} = require 'views/NavigationView'
{LoginModel} = require 'models/LoginModel'
{CurrentLoggedView} = require 'views/CurrentLoggedView'
{HoursView} = require 'views/HoursView'
{ManageSubView} = require 'views/ManageSubView'
@v
v / gist:9166246
Created February 23, 2014 03:07
Regex example
import re
input = 'vaibhav2614 #ruhack: hello there aiden'
expression = '(.+)\s+#(.+): (.+)'
output = re.search(expression, input)
print output.group(0)
print output.group(1)
@v
v / gist:bc7f99aa38236cd296f7
Created March 18, 2015 22:56
FB Post to Page bug repro
FB.ui({
from: "1716211991938896",
link: "https://etsy.com",
method: "feed"
});
diff --git a/src/components/Editor.jsx b/src/components/Editor.jsx
index 28bcd8f..2c86555 100644
--- a/src/components/Editor.jsx
+++ b/src/components/Editor.jsx
@@ -17,6 +17,8 @@ class Editor extends React.Component {
this._editor.setValue(nextProps.source);
}
+ //this disables autoclosing of HTML tags
+ this._editor.setBehavioursEnabled(false);
@v
v / a.diff
Created March 19, 2016 15:59
diff --git a/src/components/Workspace.jsx b/src/components/Workspace.jsx
index eab71ed..2a24747 100644
--- a/src/components/Workspace.jsx
+++ b/src/components/Workspace.jsx
@@ -58,11 +58,11 @@ class Workspace extends React.Component {
}
componentDidMount() {
- addEventListener('beforeunload', this._confirmUnload);
+ //addEventListener('beforeunload', this._confirmUnload);
@v
v / index.html
Created October 23, 2016 19:25
Exported from Popcode. Click to import: https://popcode.org/?gist=5467add1388906ff18161e36faa61bba
<!DOCTYPE html>
<html>
<head>
<title>Review of Types in Javascript</title>
</head>
<body>
</body>
</html>