Skip to content

Instantly share code, notes, and snippets.

View c10b10's full-sized avatar
🥗

Alex Ciobica c10b10

🥗
View GitHub Profile
@c10b10
c10b10 / what-forces-layout.md
Created October 7, 2015 11:49 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@c10b10
c10b10 / github_repos.rb
Last active December 11, 2018 08:48
Clones all the private github repos from a certain organization, including branches, submodules and wiki
#!/usr/bin/env ruby
require "json";
# Change github credentials and organization name
github = {:user => "johndoe", :pass => "password", :org => "twitter"}
repos = `curl --user "#{github[:user]}:#{github[:pass]}" https://api.github.com/orgs/#{github[:org]}/repos\?per_page\=200\&type\=private`
for repo in JSON.load(repos)
puts "\n+++ Starting with " + repo["name"]
%x[git clone #{repo["ssh_url"]}]
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
#!/usr/bin/env bash
set -e
function echo_color() {
# Some colors:
# 0-black, 1-red, 3-yellow, 76-green, 26 or 27-blue, 237-grey, 255-white
local background=''
local foreground=''
#!/usr/bin/env bash
set -e
function echo_color() {
# Some colors:
# 0-black, 1-red, 3-yellow, 76-green, 26 or 27-blue, 237-grey, 255-white
local background=''
local foreground=''

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@c10b10
c10b10 / Coding Standards and Best Practices.md
Created February 24, 2013 10:07
Coding Standards and Best Practices
@c10b10
c10b10 / pgessays.py
Created February 16, 2013 23:36 — forked from olasitarska/pgessays.py
Builds epub book out of Paul Graham's essays
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html)
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
@c10b10
c10b10 / SkypeMenuUpdater.rb
Created February 8, 2013 17:22 — forked from pwc3/SkypeMenuUpdater.rb
Should Add Skype Notifications in Menu
#!/usr/bin/env ruby
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework"
GDB = IO.popen("gdb", "w")
def gdb(cmd)
GDB.puts cmd
GDB.flush
end
@c10b10
c10b10 / Post type argument test
Last active December 11, 2015 15:29 — forked from jeremyfelt/gist:2625350
Post type argument test results
'rewrite' => true
'public' => true 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine
'public' => false 'publicly_queryable' => true /cpt-slug/cpt-post-slug Loads fine
'public' => true 'publicly_queryable' => false /cpt-slug/cpt-post-slug 404 Error
'public' => false 'publicly_queryable' => true /cpt-slug-cpt-post-slug 404 Error
'rewrite' => false
'public' => true 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine
'public' => true 'publicly_queryable' => true /?p=ID&post_type=cpt-slug Loads fine
'public' => false 'publicly_queryable' => true /?cpt-slug=cpt-post-slug Loads fine