Skip to content

Instantly share code, notes, and snippets.

import { Pipe } from 'angular2/core.js';
/**
* Map to Iteratble Pipe
*
* It accepts Objects and [Maps](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
*
* Example:
*
* <div *ngFor="#keyValuePair of someObject | mapToIterable">
@hmanicka
hmanicka / app.py
Last active April 30, 2021 15:22
Flask-Admin: To update timestamp with timezone field with UTC
import pytz
class MyView(MyModelView):
# Display the time in user's local timezone on the List View
column_formatters =
dict(scheduledtime=lambda v,c,m,p: m.scheduledtime.replace(tzinfo=pytz.utc).astimezone(tz=pytz.timezone(config.LOCAL_TIMEZONE)))
# Display the time in user's timezone on the Edit View
def edit_form(self, obj):
form = self._edit_form_class(get_form_data(), obj=obj)
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

Proposed module resolution strategy

Proposed set of rules is an extension to baseUrl based mechanics used by RequireJS or SystemJS.

Core elements of the system are baseUrl and path mappings. Resolution process describes how they are used together.

BaseUrl

All non-rooted paths are computed relative to baseUrl. Value of baseUrl is determined as either:

@renshuki
renshuki / ubuntu_agnoster_install.md
Last active April 23, 2024 13:04
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@nojaf
nojaf / package.json
Created November 21, 2015 10:19
From TypeScript to Babel to ES5 with webpack
{
"name": "webpack-ts-babel",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@Quotation
Quotation / shell.py
Last active August 19, 2023 14:23 — forked from defrex/shell.py
Use ptpython for Django shell
from django.core.management.commands.shell import Command as ShellCommand
import os
class Command(ShellCommand):
shells = ShellCommand.shells.append('ptpython')
def ptpython(self):
try:
# old ptpython
@taylor224
taylor224 / wifi.py
Last active February 8, 2024 15:22
Python WiFi Example
# -*- coding: utf-8 -*-
import wifi
def Search():
wifilist = []
cells = wifi.Cell.all('wlan0')
@matheus-santos
matheus-santos / cheat_sheet_socketio
Last active May 1, 2019 19:23
SocketIO cheat sheet to emit messages through sockets
// SocketIO cheat sheet
// SocketIO is a library that makes websockets communications easier.
// Page: http://socket.io/
// ref: http://stackoverflow.com/a/10099325
// send to current request socket client
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.sockets.emit('message', "this is a test");
@dynamicguy
dynamicguy / install-opencv-2.4.11-in-ubuntu.sh
Last active April 3, 2024 20:20
install opencv-2.4.11 in ubuntu
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev