Skip to content

Instantly share code, notes, and snippets.

View aschyiel's full-sized avatar

Ulysses Levy aschyiel

View GitHub Profile
@ericelliott
ericelliott / essential-javascript-links.md
Last active June 14, 2025 18:43
Essential JavaScript Links
@vgeshel
vgeshel / function.js
Last active March 6, 2025 13:44
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@fxn
fxn / gist:427dca61ec44adf8253b
Last active July 2, 2019 18:14
gzip assets with Capistrano
# Compresses all .js and .css files under the assets path.
namespace :deploy do
# It is important that we execute this after :normalize_assets because
# ngx_http_gzip_static_module recommends that compressed and uncompressed
# variants have the same mtime. Note that gzip(1) sets the mtime of the
# compressed file after the original one automatically.
after :normalize_assets, :gzip_assets do
on release_roles(fetch(:assets_roles)) do
assets_path = release_path.join('public', fetch(:assets_prefix))
within assets_path do
@nagitsu
nagitsu / queries.json
Last active May 11, 2018 22:54
Elasticsearch Intro Queries
# Indexando un documento.
POST /newyork/article
{
"title": "'Doctor Who' Versus 'Sherlock'? Keep Dreaming, Comic-Con",
"keywords": ["doctor-who", "sherlock-holmes", "comic-con"],
"pub_date": "2015-07-09T21:56:18Z",
"print_page": 7,
"section_name": {
"display_name": "U.S.",
"content": "us",
@gaearon
gaearon / slim-redux.js
Last active August 7, 2025 09:46
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@alyssaq
alyssaq / 1. Install python3.7 & pip3.md
Last active April 11, 2023 02:13
Python3.7 setup on Mac 10.14 (Mojave)
  1. Install Python 3.7.x from https://www.python.org/downloads/ or via homebrew.
$ brew install python3   # Installed at /usr/local/Cellar/python3

Check that python3 has been installed by running it at the terminal:

$ python3
>>> Python 3.7.2
  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and install (this should already be installed if python was installed from python.org or homebrew):
@aschyiel
aschyiel / got.rb
Created October 17, 2016 23:33
A ruby analog of lodash#get.
module MyModuleName
# Safely navigate a hashmap via dot-notation, similar to lodash#get.
# May return nil; Assumes string keys, will not work for symbols!
#
# Example Usage:
# got(foo, 'bar.fizz.buzz')
def got(object, dot_notation_path, default_value = nil)
# FIXME: Does not support OpenStruct! -uly, july 2016
keys = dot_notation_path.split('.')
while !keys.empty? && !object.nil?
@mbajur
mbajur / alt-action-listeners.js.es6
Last active June 28, 2017 18:06
alt.js - listening for events outside of the store
/**
* ActionListeners(alt: AltInstance): ActionListenersInstance
*
* > Globally listen to individual actions
*
* If you need to listen to an action but don't want the weight of a store
* then this util is what you can use.
*
* Usage:
*
@narath
narath / faraday_post.rb
Created May 8, 2017 17:24
How to do a x-www-form-urlencoded post with Faraday
require 'faraday'
require 'uri'
data = {
:your_data => "YOUR DATA"
}
url = "some url"
response = Faraday.post(url) do |req|