Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

lju veryeasily

🎯
Focusing
Block or report user

Report or block veryeasily

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.py
from flask import Flask
from textgenrnn import textgenrnn
app = Flask(__name__)
@app.route('/<text>')
def hello(text):
textgen = textgenrnn()
return textgen.generate(prefix=text,return_as_list=True)[0]
View Flying.jsx
import React from 'react'
export default Flying = (ChildClass) => (
class extends React.Component {
render() {
<div class="flying-css-stuff">
<Flying />
</div>
}
}
@veryeasily
veryeasily / init.js
Last active Sep 14, 2019
Surfingkeys Config
View init.js
// Make F open a single link in a new, inactive tab
map('F', 'C');
map('<Alt-e>', '<Alt-s>');
map('<Alt-F12>', '<Alt-s>');
cmap('<Ctrl-j>', '<Tab>');
cmap('<Ctrl-k>', '<Shift-Tab>');
addSearchAlias('am', 'Amazon', 'https://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=');
addSearchAlias('lg', 'Library Genesis', 'http://gen.lib.rus.ec/search.php?req=');
addSearchAlias('et', 'Online Etymological Dictionary', 'https://www.etymonline.com/search?q=');
@veryeasily
veryeasily / scary-thing.coffee
Created Mar 5, 2014
Never modify properties of object pointers on your prototype in javascript, or you break things higher up in the chain. I also show a good workaround
View scary-thing.coffee
### BAD WAY ###
class Animal
Animal.prototype.foo = {bar: "baz"}
class Dog extends Animal
fred = new Dog()
View saveimages.sh
STOREFRONT=~/rtr/rtr_ruby_storefront
cd ${STOREFRONT}/public/images
for i in $(ls); do
pushd .
cd ../..
ack-grep -l "\/public\/images\/$i" > tempfile
cat tempfile
for file in $(< tempfile); do
sed "s/\/public\/images\/${i}/\/images\/${i}/g" "$file" > ${file}.bak
@veryeasily
veryeasily / defineGetters.js
Last active Dec 31, 2015
This is a quick write up using underscore to create getters from a JSON object. A good use case is when the object is a response from an endpoint.
View defineGetters.js
function defineGetters (context, obj) {
this.get = {};
// we iterate over the object via underscore creating getter functions
_.each(obj, function (val, ind, list) {
this.get[ind] = function() {
return ( !_.isObject(val) || _.isArray(val) ? val : $.extend({}, val, true) );
};
}, this);
}
@veryeasily
veryeasily / gist:5640712
Created May 24, 2013
Here is this San Francisco topic search with additional logging to show that the whole object with tons of stuff is returned. Make sure to do CTRL-J to open up the console to see the log (of course)
View gist:5640712
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<script>
var topic_id = '/en/san_francisco';
var service_url = 'https://www.googleapis.com/freebase/v1/topic';
var params = {};
You can’t perform that action at this time.