Skip to content

Instantly share code, notes, and snippets.

View veryeasily's full-sized avatar
🦌

lju veryeasily

🦌
  • Portland
  • 23:43 (UTC -08:00)
View GitHub Profile
@veryeasily
veryeasily / gist:5640712
Created May 24, 2013 01:21
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)
<!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 = {};
@veryeasily
veryeasily / defineGetters.js
Last active December 31, 2015 20:39
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.
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);
}
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 / scary-thing.coffee
Created March 5, 2014 17:35
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
### BAD WAY ###
class Animal
Animal.prototype.foo = {bar: "baz"}
class Dog extends Animal
fred = new Dog()
@veryeasily
veryeasily / surfingkeys.config.js
Last active November 9, 2024 05:46
SurfingKeys Config #JavaScript #SurfingKeys
// This is my personal Surfingkeys configuration file.
// The two globals from Surfingkeys are `api` and `settings`.
const {
aceVimMap,
mapkey,
imap,
imapkey,
getClickableElements,
import React from 'react'
export default Flying = (ChildClass) => (
class extends React.Component {
render() {
<div class="flying-css-stuff">
<Flying />
</div>
}
}
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]
```
➜ Liver git:(master✘!?) mono Jenny/Jenny.exe -v gen
Loading assemblies from /Users/lukeunderwood/NewUnity/Liver/Jenny
Jenny.exe load: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.Utils.dll
➜ Loading: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.Utils.dll
Jenny.exe load: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.Logging.dll
➜ Loading: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.Logging.dll
Jenny.exe load: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.CodeGeneration.dll
➜ Loading: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.CodeGeneration.dll
Jenny.exe load: /Users/lukeunderwood/NewUnity/Liver/Jenny/DesperateDevs.CodeGeneration.CodeGenerator.dll
@veryeasily
veryeasily / karabiner.json
Created July 23, 2021 18:05
karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@veryeasily
veryeasily / get_script_dir.sh
Last active November 18, 2021 09:10
[Get dir of current script] Gets the directory of the currently running script without getting tricked by symlinks #Shell #Zsh #Bash
#!/usr/local/bin/zsh
# @description Gets the physical location of the current script in a way that
# doesn't get tricked by symlinks
# @see https://stackoverflow.com/questions/59895/how-can-i-get-the-source-directory-of-a-bash-script-from-within-the-script-itsel
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
# next works for sourced files
# @see https://unix.stackexchange.com/a/4673/37091
SCRIPT_DIR="$(cd -- "$(dirname -- "$_")" &> /dev/null && pwd)"