Skip to content

Instantly share code, notes, and snippets.

@alexrqs
alexrqs / Preferences.sublime-settings
Created May 21, 2015 19:38
sublime text 3 preferences
{
"always_prompt_for_file_reload": false,
"atomic_save": true,
"bold_folder_labels": true,
"caret_extra_bottom": 3,
"caret_extra_top": 3,
"caret_extra_width": 2,
"color_scheme": "Packages/Seti_UI/Scheme/Seti.tmTheme",
"ensure_newline_at_eof_on_save": true,
"find_selected_text": true,
var fs = require('fs');
var request = require('request');
var mkdirp = require('mkdirp');
var lineReader = require('readline').createInterface({
input: fs.createReadStream('server.log')
});
var download = function(uri, filename, callback){
request.head(uri, function(err, res, body){
console.log('content-type:', res.headers['content-type']);
@alexrqs
alexrqs / kill_django.sh
Last active May 6, 2016 05:06
kill django by passing xargs to the end of the pipe
ps aux | grep ./manage.py | awk '{print $2}' | xargs kill
git config --global alias.au 'add -u'
git config --global alias.ai 'add -i'
git config --global alias.ap 'add -p'
git config --global alias.ci 'commit'
git config --global alias.co 'checkout'
git config --global alias.cp 'cherry-pick'
git config --global alias.big 'bisect good'
git config --global alias.bib 'bisect bad'
git config --global alias.b 'branch'
@alexrqs
alexrqs / prefix_commits.md
Created July 19, 2016 23:34
git command to prefix some words to multiple commits on the same branch.

This command will prefix xx commits number with [SYTO-640] including sqare brakets, the importance of the \c at the end of the prefix is to avoid new lines on the commit otherwise this will transform the the commit name to commit description.

more info about \c http://stackoverflow.com/questions/7154800/what-is-the-bash-escape-character-c

git filter-branch -f --msg-filter '
  echo "[SYTO-640] \c" && cat 
' HEAD~xx..HEAD
@alexrqs
alexrqs / app.js
Created September 29, 2016 19:14 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@alexrqs
alexrqs / webpack.config.babel.js
Last active April 24, 2017 23:12
webpack 2 configuration example with `webpack --opt.source=true` html/pug/jade, dev-server, eslint and scss
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import CompressionPlugin from 'compression-webpack-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import autoprefixer from 'autoprefixer'
import webpack from 'webpack'
import path from 'path'
import PACKAGE from './package.json'
@alexrqs
alexrqs / app.jsx
Last active April 25, 2017 20:53
Code spliting react router 4 with import() and webpack 2.4
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
import async from './components/async'
class App extends Component {
render() {
return (
<Router>
<div>
<Route exact path="/" component={async(import('./pages/home')) } />
@alexrqs
alexrqs / App.jsx
Created May 11, 2017 00:56
Very ugly TodoApp with create-react-app redux, classnames and transitions to explain on pioneras developers
import React, { Component } from 'react'
import TodoList from './components/TodoList'
import TodoInput from './components/TodoInput'
import Filter from './components/Filter'
import './App.css'
class App extends Component {
render() {
return (
<div className="App">
@alexrqs
alexrqs / install.sh
Created June 17, 2018 21:53
webpack boilerplate for js with babel
yarn add -D webpack webpack-cli webpack-dev-server babel-loader@next @babel/core @babel/preset-env @babel/preset-stage-0 html-webpack-plugin