Skip to content

Instantly share code, notes, and snippets.

View andreiglingeanu's full-sized avatar

Andrei Glingeanu andreiglingeanu

View GitHub Profile
@artemeff
artemeff / 2015.md
Last active November 25, 2016 15:34
  • Ушел из компании мечты (фейл, пришлось), а потом ее купила Airbnb (вин);
  • Запустил второй проект на Эрланге в продакшн (трекер общественного транспорта, щас он уже все);
  • Для этого проекта на Эрланге сделал красивое приложение для Windows Phone в продакшн (прям качали с магазина);
  • Затащил лучшего друга в программирование, всячески ему помогал и сейчас он уже на зарплате;
  • Затащил этот проект с трекингом транспорта в дипломную и защитил на отлично, закончил универ;
  • Попал в сильную команду рубистов, там немного научили в DDD и поставили на путь, куда идти дальше в ООП;
  • Попал в другую сильную команду рубистов, где хорошо прокачал теорию и практику распределенных систем;
  • Возненавидел тех, кто использует Elasticsearch не по назначению (никогда в жизни не устану это повторять, это травма);
  • Прокачался во фронтенде (react, babel и все такое модное с БД на клиенте и иммутабельными стейтами);
  • Попал в команду ROM, написал два адаптера в продакшн (rom-elasticsearch, rom-redis) и один для себя (rom-rethin
@captainsafia
captainsafia / deploy.js
Last active September 16, 2017 11:06
A quick Node script to allow multi-environment deploys with now
#! /usr/bin/env node
'use strict';
const program = require('commander');
const fs = require('fs');
const { spawn } = require('child_process');
program
.version('1.0.0')
.option('-e, --environment <environment>', 'Environment to deploy to')
// https://github.com/kolodny/immutability-helper
/** Declaration extension point */
declare namespace ImmutabilityHelper {
interface CustomOperators<T> {
/* $someShit?: T */
/* $moreShit?: T */
}
}
@nellshamrell
nellshamrell / Beneath the Surface: Embracing the True Power of Regular Expressions in Ruby
Last active December 3, 2017 16:35
Resources I consulted when preparing my presentation "Beneath the Surface: Embracing the True Power of Regular Expressions in Ruby"
All of these resources were extremely valuable as I researched regex, finite state machines, and regex in Ruby. Check them out, they're full of fantastic information!
Articles
"Exploring Ruby's Regular Expression Algorithm" by Pat Shaughnessy
http://patshaughnessy.net/2012/4/3/exploring-rubys-regular-expression-algorithm
"Finite State Machines and Regular Expressions" by Eli Bendersky
http://www.gamedev.net/page/resources/_/technical/general-programming/finite-state-machines-and-regular-expressions-r3176
"Regular Expression Matching Can Be Simple and Fast" by Russ Cox
@jonathantneal
jonathantneal / mediaquery.js
Last active February 6, 2018 21:21
Media Queries for everybody
(function () {
var
documentElement = document.documentElement,
viewportFontSize, viewportHeight, viewportIsPortrait, viewportMax, viewportMin, viewportWidth;
function getViewportFontSize() {
var
body = documentElement.appendChild(document.createElement('body')),
iframe = document.createElement('iframe'),
iframeDocument;
@osartun
osartun / elementsFromPoint
Last active April 16, 2018 22:55
Get a jQuery-set of all the visible elements from one Point in your document. The elements are in reversed order (the element on the top is the last element in the set).
(function ($, document, undefined) {
$.extend({
/**
* A static jQuery-method.
* @param {number} x The x-coordinate of the Point.
* @param {number} y The y-coordinate of the Point.
* @param {Element} until (optional) The element at which traversing should stop. Default is document.body
* @return {jQuery} A set of all elements visible at the given point.
*/
elementsFromPoint: function(x,y, until) {
@necrogami
necrogami / cors.conf
Last active June 7, 2018 15:40
Dynamic nginx config from my mac.
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, HEAD';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
@developit
developit / async-examples.js
Last active February 19, 2020 00:43
Async Array utilities in async/await. Now available as an npm package: https://github.com/developit/asyncro
/** Async version of Array.prototype.reduce()
* await reduce(['/foo', '/bar', '/baz'], async (acc, v) => {
* acc[v] = await (await fetch(v)).json();
* return acc;
* }, {});
*/
export async function reduce(arr, fn, val, pure) {
for (let i=0; i<arr.length; i++) {
let v = await fn(val, arr[i], i, arr);
if (pure!==false) val = v;
@jacob-beltran
jacob-beltran / requestAnimationFrame.js
Last active April 17, 2020 04:05
React Performance: requestAnimationFrame Example
// How to ensure that our animation loop ends on component unount
componentDidMount() {
this.startLoop();
}
componentWillUnmount() {
this.stopLoop();
}
@brobertsaz
brobertsaz / serversetup.md
Last active July 6, 2020 08:56
Ubuntu 12.04 Ruby, Rails, Nginx, Unicorn

Ubuntu 12.04, Ruby, Rails, Nginx, Unicorn and git-deploy

In the seemlingly endless search for the actual correct and easy way to deploy a Rails app, we have tried several ways. We tried out using Apache2 and running a cluster of Thin servers. With the built in threading of Puma we decided to use it with Nginx.

Server Setup

  • Create new server
  • Login to new server
    • ssh root@IPaddress (you can also use the domain name if you have the DNS setup already)
    • accept the RSA key