Skip to content

Instantly share code, notes, and snippets.

View aurbano's full-sized avatar
🎯
ML

Alejandro U. Alvarez aurbano

🎯
ML
View GitHub Profile
@aurbano
aurbano / Gemfile
Last active November 8, 2023 01:39
Post code coverage as a comment to a Github PR from Circle CI
source "https://rubygems.org"
gem "octokit"
gem "nokogiri"
gem "json"
@paulirish
paulirish / what-forces-layout.md
Last active June 19, 2024 15:52
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@eclecticmiraclecat
eclecticmiraclecat / spread kindness
Created July 6, 2015 03:52
make the world a beautiful place
#!/usr/bin/python
import praw
import pdb
import re
import os
import time
user_agent = ("spread kindness /u/eclecticmiraclecat13")
r = praw.Reddit(user_agent=user_agent)
@markthiessen
markthiessen / inlineConfirm.js
Last active August 29, 2015 14:10
AngularJS (+Bootstrap) directive for inline ngClick confirmation
(function () {
'use strict';
angular.module('yourModule').directive('inlineConfirm',
['$compile',
function ($compile) {
return {
priority: -100,
link: function (scope, elm, attrs) {
var wrapperTemplate = '<div class="popover inline-confirm" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>';
var template =
@richardkundl
richardkundl / Sift3Distance.cs
Created November 14, 2013 15:15
Get Sift3 distance from two words. Simmilar to the Levenshtein distance, but it's four time faster. Verifying that(http://norvig.com/ngrams/) data sets.
/// <summary>
/// Get Sift3 distance from two words.
/// (eg: spell checking)
/// </summary>
/// <param name="source"> source string </param>
/// <param name="actual"> actual string </param>
/// <param name="maxOffset"> max offset </param>
/// <returns> The distance of the two words. </returns>
public static float GetSift3Distance(string source, string actual, int maxOffset)
{
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@rgthree
rgthree / _readme.md
Last active August 22, 2016 15:47
Google's iOS Gmail folding loading animation using CSS transitions & JS

NOTE

This has stopped working due to an odd timing issue with a minuscule -webkit-transition-duration value firing a webkitTransitionEnd

Checkout a pure CSS version here: https://github.com/rgthree/google-loader-css


Google/Gmail's "Folding Circle"

@sindresorhus
sindresorhus / github-email.sh
Created January 11, 2013 17:46
Magically retrieves a GitHub users email even though it's not publicly shown
#!/bin/bash
# Created by Sindre Sorhus
# Magically retrieves a GitHub users email even though it's not publicly shown
[ "$1" = "" ] && echo "usage: $0 <GitHub username> [<repo>]" && exit 1
[ "$2" = "" ] && repo=`curl "https://api.github.com/users/$1/repos?type=owner&sort=updated" -s | sed -En 's|"name": "(.+)",|\1|p' | tr -d ' ' | head -n 1` || repo=$2
curl "https://api.github.com/repos/$1/$repo/commits" -s | sed -En 's|"(email\|name)": "(.+)",?|\2|p' | tr -s ' ' | paste - - | sort -u -k 1,1
/* **She grows old and feeble** */
//...But she would always have to return back to her dull world of chores and grown-ups.
return function() {
// And her latest story would be filled with wonder
latestStory = adventures[adventures.length - 1];
// But time is a bitch...
setInterval(function() {
// and our dear princess can't help but forget her adventures,