Skip to content

Instantly share code, notes, and snippets.

View c10b10's full-sized avatar
🥗

Alex Ciobica c10b10

🥗
View GitHub Profile
#!/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=''
#!/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
@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 / gist:3447964
Created August 24, 2012 09:12 — forked from AAS/gist:2036916
OS X 10.7 Lion Finder - Folders on top
Open Terminal.
Type this command:
cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/
Now, the file we want to mess around is the InfoPlist.strings. But unfortunately, this file cannot be edited directly using text editor in Lion. But no worries. Run this command to make it editable.
sudo plutil -convert xml1 InfoPlist.strings
Now the file should be editable and readable. Use your favorite text editor and open InfoPlist.strings. I just used vim
sudo vim InfoPlist.strings
@c10b10
c10b10 / wp-plugin-path.php
Created November 17, 2012 12:05 — forked from alexkingorg/wp-plugin-path.php
Defining symlink compatible paths for WordPress plugins
<?php
// include this near the top of your plugin file
$my_plugin_file = __FILE__;
if (isset($plugin)) {
$my_plugin_file = $plugin;
}
else if (isset($mu_plugin)) {
@c10b10
c10b10 / pgessays.py
Created November 20, 2012 11:30 — 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>
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
import re, ez_epub, urllib2, genshi
@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
@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 / 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/
"""