Skip to content

Instantly share code, notes, and snippets.

View jilljenn's full-sized avatar

Jill-Jênn Vie jilljenn

View GitHub Profile
@JacobBennett
JacobBennett / blog.md
Last active June 7, 2024 17:42
Clean up your Vue modules with ES6 Arrow Functions

Recently when refactoring a Vue 1.0 application, I utilized ES6 arrow functions to clean up the code and make things a bit more consistent before updating to Vue 2.0. Along the way I made a few mistakes and wanted to share the lessons I learned as well as offer a few conventions that I will be using in my Vue applications moving forward.

The best way to explain this is with an example so lets start there. I'm going to throw a rather large block of code at you here, but stick with me and we will move through it a piece at a time.

<script>

// require vue-resource...

new Vue({
@ahwillia
ahwillia / pca_alt_min.py
Created October 30, 2016 06:52
Alternating Minimization in Tensorflow (PCA example)
import numpy as np
import tensorflow as tf
# N, size of matrix. R, rank of data
N = 100
R = 5
# generate data
W_true = np.random.randn(N,R)
C_true = np.random.randn(R,N)
@sleekslush
sleekslush / formset_updateview_example.py
Created January 6, 2012 06:42
An example of extending UpdateView to use a formset instead of a form
class UserUpdateView(AuthenticatorViewMixin, UpdateView):
model = User
template_name = 'manager/authenticator/user_list.html'
def get_form_class(self):
return modelformset_factory(User, extra=0)
def get_form_kwargs(self):
kwargs = super(UserUpdateView, self).get_form_kwargs()
kwargs['queryset'] = kwargs['instance']
@aurora
aurora / gist:793108
Created January 24, 2011 11:29
applescript: rename selected itunes tracks
--
-- renames selected tracks
--
-- from:
-- artist: "Various Artists"
-- name: "name-of-artist - name-of-track"
--
-- to:
-- artist: "name-of-artist"
-- album artist: "Various Artists"
@cheeaun
cheeaun / fb-friend-locationer.html
Created August 29, 2010 03:04
Get your Facebook friends' current location
<!DOCTYPE html>
<title>FB Friend Locationer</title>
<style>
* {font-family: sans-serif;}
table th, table td{border: 1px solid #ccc; padding: 0 1em;}
</style>
<table id="loc">
<thead>
<tr>
<th>Name</th><th>Current location</th>