Skip to content

Instantly share code, notes, and snippets.

View un33k's full-sized avatar
🎯
Focusing

Val N. un33k

🎯
Focusing
View GitHub Profile
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@un33k
un33k / angular_weather_service.js
Last active August 29, 2015 14:08
AngularJS to get weather from Yahoo
var tvapp = angular.module('tvapp');
tvapp.service('weatherService', function($http, $q){
var getQuery = function(location) {
var query = 'select * from weather.forecast where woeid in ' +
'(select woeid from geo.places(1) where text="city, state country")';
query = query.replace('city', location.city)
.replace('state', location.state)
import sys
ID_TOKEN = str(sys.maxint)
URLS = {}
class HyperlinkedIdentityField(serializers.HyperlinkedIdentityField):
"""
This is a performance wrapper for HyperlinkedIdentityField.
We save a ton of time by pre-computing the URL the first time it's
accessed, to save calling reverse potentially thousands of times
per request.
# Encrypt the repository
# Remove/modify this line if the repository is meant to be open-source
*.* filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
# These files are text and should be normalized (Convert crlf => lf)
*.php text
*.css text
*.js text
*.htm text
#/bin/bash
active_id=$(printf "0x%08x\n" $(xdotool getactivewindow))
active_title=$(wmctrl -l | grep $active_id | awk '{for (i=4;i<=NF;++i)print $i}')
if $(echo $active_title | grep -q -i '\- Sublime Text$'); then
bash_title=$(wmctrl -l | grep -i 'st3_bash' | awk '{for (i=4;i<=NF;++i)print $i}')
wmctrl -a $bash_title
else
'use strict';
// USAGE
// Development (serve, superstatic, watch) : gulp watch
// Build dist package (minify, version) : gulp build
// Build and start divshot server : gulp build --serve

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@un33k
un33k / sv-sign-up-form.jade
Last active August 29, 2015 14:27 — forked from SvitlanaShepitsena/sv-sign-up-form.jade
Lumx form (Tutorial: Advanced form validation with AngularJs using compile service. AngularJs tutorial )
div(flex-container='column')
.card
div(class='p+')
span.display-block.fs-title.mb {{title|translate}}
.divider.divider--dark
form.mt(name='signUpForm' novalidate sv-form-val)
div(flex-container='column' flex)
div(flex-item='')
lx-text-field(label='{{name|translate}}')
input(type='text'
@un33k
un33k / markdown.md
Last active September 7, 2015 01:35 — forked from jonschlinkert/markdown-cheatsheet.md
A better markdown cheatsheet. I used Bootstrap's Base CSS documentation as a reference.

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading