Skip to content

Instantly share code, notes, and snippets.

View un33k's full-sized avatar
🎯
Focusing

Val Neekman un33k

🎯
Focusing
View GitHub Profile
@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'

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

'use strict';
// USAGE
// Development (serve, superstatic, watch) : gulp watch
// Build dist package (minify, version) : gulp build
// Build and start divshot server : gulp build --serve
#/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
# 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
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.
@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)
@un33k
un33k / osx_bootable_iso.sh
Last active March 6, 2018 21:17
Create bootable OSX ISO
#!/bin/bash
# Use with care ...
# -----------------------------------------
# Mountain Lion, Mavericks, Yosemite ..
OS=Yosemite
# Mount the installer image
hdiutil attach /Applications/Install\ OS\ X\ "$OS".app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
@un33k
un33k / mk.osx.iso.sh
Last active March 6, 2018 21:17
Make_OSX_Installable_ISO
#!/bin/bash
# Use with care ...
OS="Yosemite"
IMG_SIZE=8g
BUILD_MNT=/tmp/"$OS"_Build
INSTALL_MNT=/tmp/"$OS"_Install
INSTALL_DMG=/Applications/Install\ OS\ X\ "$OS".app/Contents/SharedSupport/InstallESD.dmg