Skip to content

Instantly share code, notes, and snippets.

View teebot's full-sized avatar

Thibaut Nguyen teebot

View GitHub Profile
@teebot
teebot / sticky-scroll.coffee
Created January 12, 2016 11:17
sticky scroll directive in coffeescript
appDirectives.directive 'stickyScroll', ->
return {
restrict: 'A'
link: (scope, element, attr) ->
unregisterWatch = scope.$watch(
-> return element[0].scrollHeight,
->
element[0].scrollTop = element[0].scrollHeight
)
@teebot
teebot / wrapper.js
Created January 27, 2016 11:25
Wrap multiple functions in one
const fnWrapper = (...args) => () => args.forEach(f => f());
const method1 = document.write.bind(document, ['hello']);
const method2 = document.write.bind(document, ['world']);
const wrapped = fnWrapper(method1, method2);
wrapped();

Install node through https://github.com/coreybutler/nvm-windows

use latest node with nvm install latest

Install python 2.7

npm config set python python2.7

Install Visual Studio Community 2015 Edition. (Custom Install, Select Visual C++ during the installation)

@teebot
teebot / createLessFiles.js
Last active October 18, 2016 09:06
create a less file for each component
const glob = require('glob');
const fs = require('fs');
glob('**/*.component.ts', (err, files) => {
files.forEach((file) => {
let lessFileName = file.replace('.component.ts', '.less');
try {
fs.statSync(lessFileName);
}
catch (e) {
console.log(`Writing ${lessFileName}`);
node -e "require('http').createServer().listen(8086)"
find . -name 'package-lock.json' -delete
@teebot
teebot / gist:6cbe40ed91e09567e7ed8a9268911ff3
Created December 20, 2017 15:15
Delete firefox cert (when self signed certs fail)
find ~/Library/Application\ Support/Firefox -name '*.db' -delete
@teebot
teebot / koa2-sass.ts
Created February 11, 2018 16:40
A typescript koa 2 sass middleware
import * as fs from 'fs';
import * as Koa from 'koa';
import * as sass from 'node-sass';
import * as path from 'path';
import * as url from 'url';
import * as util from 'util';
const sassRenderAsync = util.promisify(sass.render);
const fileExistsAsync = util.promisify(fs.exists);
export default (options: ISassOptions) => {
@teebot
teebot / parcel_and_typescript_react.txt
Created April 26, 2018 09:29
Parcel and Typescript React
npm install -g parcel-bundler
npm init -y
npm i react react-dom @types/react @types/react-dom
tsc --init
======tsconfig.json=======
uncomment and set jsx to "react"
leave rest as default
@teebot
teebot / python_django_setup.md
Created October 25, 2018 07:41
Python django setup

Setup Python

brew install pyenv

Make sure your bashrc file initializes pyenv eval "$(pyenv init -)"

List python version pyenv install --list