Skip to content

Instantly share code, notes, and snippets.

View gregtap's full-sized avatar
🐬

Gregory TAPPERO gregtap

🐬
  • Paris
View GitHub Profile
@gregtap
gregtap / base.hbs
Created October 27, 2015 05:24
Ember templates
{{nav-menu}}
{{nav-bar}}
<main>
{{outlet}}
</main>
@gregtap
gregtap / components.nav-bar.js
Last active October 27, 2015 02:50
ember service observable
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'nav',
core: Ember.inject.service('core'),
actions: {
toggleMenu: function() {
var isMenuVisible = this.get('core.isMenuVisible');
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'nav',
isMenuVisible: false,
actions: {
toggleMenu: function() {
this.toggleProperty('isMenuVisible');
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'nav',
isMenuVisible: false,
actions: {
toggleMenu: function() {
this.toggleProperty('isMenuVisible');
@gregtap
gregtap / foo.go
Last active August 29, 2015 14:27
src/ondemand/main.go:24: StasdClient declared and not used
package main
type hub struct {
// Registered connections.
connections map[*connection]bool
// Inbound messages from the connections.
broadcast chan []byte
@gregtap
gregtap / demo.py
Created July 23, 2015 22:05
Postgres Djagno date_trunc
qs = Foo.objects.filter(
type=0,
duration_minutes__gt=0,
created__gt=thirty_days_ago
)
qs = qs.extra({
'day': "date_trunc('day', foos_foo.created AT TIME ZONE 'America/Chicago')"
}).values('day').order_by().annotate(sum=Sum('duration_minutes'))
@gregtap
gregtap / haproxy.cfg
Last active August 29, 2015 14:16 — forked from GABeech/haproxy.cfg
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/0.3.4/sockjs.min.js"></script>
</head>
<body>
<h1>SOCKJS demo</h1>
<script>
var sock = new SockJS("http://localhost:8888/live");
sock.onopen = function() {
console.log("open");
/*
* draw a multiline string rotated in a canvas
*
* @param ctx (M) context of the canvas
* @param text (M) string may contain \n
* @param posX (M) horizontal start position
* @param posY (M) vertical start position
* @param textColor color
* @param rotation in degrees (by 360)
* @param font must be installed on client use websafe
@gregtap
gregtap / Dockerfile
Last active August 29, 2015 14:10 — forked from thom-nic/Dockerfile
###
# Node.js app Docker file
#
# Some basic build instructions:
# ```
# # you should delete node_modules b/c you don't want that copied during 'ADD'
# docker build -t thom-nic/node-bootstrap .
# # run a shell in the container to inspect the environment (as root):
# docker run --rm -itu root thom-nic/node-bootstrap /bin/bash
# ```