Skip to content

Instantly share code, notes, and snippets.

View xgenvn's full-sized avatar

TuNA xgenvn

View GitHub Profile
@xgenvn
xgenvn / ide_helper.php
Created July 8, 2012 18:02
Laravel3 IDE Helper
<?php
class Auth extends Laravel\Auth {}
/**
* @method static add(string $name, string $source, array $dependencies = array(), array $attributes = array())
* @method static string styles()
* @method static string scripts()
*/
class Asset extends Laravel\Asset {}
class Autoloader extends Laravel\Autoloader {}
class Bundle extends Laravel\Bundle {}
/*
See dev dependencies https://gist.github.com/isimmons/8927890
Compiles sass to compressed css with autoprefixing
Compiles coffee to javascript
Livereloads on changes to coffee, sass, and blade templates
Runs PHPUnit tests
Watches sass, coffee, blade, and phpunit
Default tasks sass, coffee, phpunit, watch
*/
@xgenvn
xgenvn / 0_reuse_code.js
Created August 7, 2014 15:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@xgenvn
xgenvn / app.js
Last active September 8, 2015 02:40 — forked from kim3er/app.js
Knockout with Sammy (http://learn.knockoutjs.com/#/?tutorial=webmail)
function WebmailViewModel() {
// Data
var self = this;
self.folders = ['Inbox', 'Archive', 'Sent', 'Spamh'];
self.chosenFolderId = ko.observable();
self.chosenFolderData = ko.observable();
self.chosenMailData = ko.observable();
// Behaviours
self.goToFolder = function(folder) { location.hash = folder };
@xgenvn
xgenvn / bottle_example.py
Created November 22, 2015 16:48 — forked from Arthraim/bottle_example.py
a python web framework bottle's example
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@xgenvn
xgenvn / tmux-cheatsheet.markdown
Created May 12, 2016 16:32 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@xgenvn
xgenvn / _vimrc
Last active December 22, 2016 17:22 — forked from aburok/_vimrc
Vim common configuration for GVim and VsVim
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
" Vim ESCAPE Combinations{{{
imap jj <esc>
imap <S-Space> <Esc>
vnoremap <S-Space> <Esc>
" }}}
import time
class RangeSensor:
def __init__(self):
pass
def make_generator(self):
t_end = time.time() + 0.1
# tell sensor to start measurement
@xgenvn
xgenvn / micropython-html-slides.py
Created November 1, 2016 02:19 — forked from turbinenreiter/micropython-html-slides.py
a small presentation about MicroPython including a 'webserver' to serve it from a microcontroller
import socket, machine
# This is the HTML, CSS and js to deliver to the client.
# You can (should) store this in another file and read from there,
# but I am lazy.
# The CSS and HTML to display pretty code is from pygments.
upy = """<!DOCTYPE html>
<html>
<head>
<title>I'm a website running on a Microcontroller.</title>
@xgenvn
xgenvn / serialplot2
Created November 1, 2016 02:19 — forked from turbinenreiter/serialplot2
plotting data from serial port with matplotlib
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import serial
fig, ax = plt.subplots()
line, = ax.plot(np.random.rand(10))
ax.set_ylim(-5000, 5000)
xdata, ydata = [0]*100, [0]*100
raw = serial.Serial("/dev/ttyUSB1",9600)