Skip to content

Instantly share code, notes, and snippets.

View wnuqui's full-sized avatar

Wilfrido Nuqui Jr. wnuqui

  • Mandaluyong, Philippines
View GitHub Profile
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@montanaflynn
montanaflynn / CONCURRENCY.md
Last active June 28, 2024 12:00
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.

@paulirish
paulirish / readme.md
Last active April 2, 2024 20:18
resolving the proper location and line number through a console.log wrapper

console.log wrap resolving for your wrapped console logs

I've heard this before:

What I really get frustrated by is that I cannot wrap console.* and preserve line numbers

We enabled this in Chrome DevTools via blackboxing a bit ago.

If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.

@vsouza
vsouza / .bashrc
Last active June 14, 2024 08:45
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@mprymek
mprymek / gist:8379066
Last active July 22, 2022 09:18
Elixir metaprogramming example
# This is an example of metaprogramming in the Elixir language.
#
# We will define a domain specific language (DSL) for the definition
# of a service which is watched by several sensors.
# Each sensor watches some property/functionality of the service and
# returns the result of the check.
#
# To determine if the service is functioning properly, we need functions
# to run all the sensors' code and gather the returned data.
#
@nateware
nateware / haproxy.conf
Created October 31, 2012 15:36
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#
@jimweirich
jimweirich / and_example_spec.rb
Created September 12, 2012 12:17
Description of the "And" Experimental feature for RSpec/Given (was "Also")
# Experimental And Clauses
#
# I've been thinking about tests where there are multiple Thens
# in a single context. All the Givens and before blocks are run
# for each Then. Since Then's are idempotent, that seems to be a waste.
#
# Maybe we can introduce And clauses. They are like Then clauses, but
# they reuse the Givens of an existing Then clause. This could make a
# difference in spec that have expensive setups.
#
@jimweirich
jimweirich / cfb2.rb
Created July 9, 2012 01:25
Inspired by "Programming with Nothing" http://experthuman.com/programming-with-nothing. See comment below for some details.
require './interface'
puts to_strings(->(limit) {
->(lst) {
->(f) {
->(f) {
->(g) {
->(n) {
f.(g.(g)).(n)
}
}.(->(g) {
@igrigorik
igrigorik / auth.js
Created June 20, 2012 22:44
SPDY basic auth
var spdy = require('spdy'),
fs = require('fs');
var options = {
key: fs.readFileSync(__dirname + '/keys/mykey.pem'),
cert: fs.readFileSync(__dirname + '/keys/mycert.pem'),
ca: fs.readFileSync(__dirname + '/keys/mycsr.pem')
};
var server = spdy.createServer(options, function(req, res) {
@jimweirich
jimweirich / base_spec-fragment.rb
Created June 20, 2012 18:51
Investigating "super unless allow" issues
# Demonstrating the the "super unless allow?(method)" line *might* cause
# problems, but only under weird circumstances involving the ancestors
# of the Draper::Base class. Since the ancestor list is pretty stable,
# this probably isn't an issue (note I had to include a module into
# Draper::Base to trigger the problem -- Yikes!).
#
# So, after analysis, "super unless allow?" isn't a practical problem.
#
# HOWEVER, it would be nice for the code to reflect that it isn't a
# problem without requiring extensive research.