Skip to content

Instantly share code, notes, and snippets.

View kalabro's full-sized avatar
😻

Kate Marshalkina kalabro

😻
View GitHub Profile
@bentruyman
bentruyman / Custom.css
Created August 17, 2011 00:30
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nikic
nikic / guestbook.markdown
Created July 29, 2012 14:21
Quick doesn't have to mean dirty: Also applies to PHP!

Quick doesn't have to mean dirty: Also applies to PHP!

This is just a quick response to http://me.veekun.com/blog/2012/07/28/quick-doesnt-mean-dirty/. I won't bother to write a proper blog post for this, so a Gist will have to do ;)

When I read that article, one thing really striked me: If you want to quickly create a web app in PHP, you do exactly the same. I mean, exactly.

I never used the Silex microframework before, so I took this as a chance to see how it works. I'll just do the same as eevee did, only with a bit less commentary (this is a Gist after all!)

I hope that this will show you that PHP and Python are really similar to work with. Also this should show that just because you're using PHP, doesn't mean that you write dirty code. The similarity in the process and code is really incredible :)

@perusio
perusio / gist:3778833
Created September 24, 2012 22:27
How to distinguish a real 503 from Drupal maintenance page in Nginx
## This relies on using Lua. In particular the header_filter_by_lua. The solution is based
## on the presence of the Etag header for the drupal maintenance page (theme). For a real 503
## there's no Etag. We set the header X-Maintenance to YES in that case. Now you can distinguish
## between a real 503 and the Drupal maintenance page.
error_page 503 = @503;
location @503 {
header_filter_by_lua '
if ngx.header.etag ~= "" then
@klaasvw
klaasvw / translation.migrate.php
Created October 17, 2012 08:52
Migrating translations using drupal migrate.
<?php
/**
* Migration class for migrating the source translations.
*/
class MySourceTranslationMigration extends Migration {
// Nothing special here. Just set up a node migration, migrating to nodes
// that will serve as translation sources.
// ...
@runekaagaard
runekaagaard / pgx.rst
Last active May 14, 2025 13:41
Bash scripts for extracting individual databases from a sql file dumped using pg_dumpall

Postgresql Xtra commands

  • pgx_list_dbs: Lists the names of databases in an .sql file dumped using pg_dumpall.
  • pgx_extract_db: Extracts a single database from a sql file dumped with pg_dumpall and outputs its content to stdout.

Installation

@perusio
perusio / gist:9033447
Last active August 29, 2015 13:56
Create a map to extract the subdir.
map $uri $drupal_dir {
~^/(?<dir>[^/]*)/ $dir;
}
@drclaw
drclaw / drush-security-update.sh
Last active November 17, 2015 18:19
A little wrapper around drush pm-update --security-only that checks for changes to .htaccess, .gitignore and robots.txt. Also checks for a .drush-lock-update in the root in case core patches need to be re-applied
#!/bin/bash
#
# Run a security update on a Drupal 7 site
#
# Requires the bash function ask_yes_no()
# https://gist.github.com/drclaw/a39c7272413f2f8ba860
#
function drush_security_update() {

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text
@kylewelsby
kylewelsby / promise-when.js
Created September 23, 2015 18:45
wait until condition is met before resolving promise.
// setup
var value = false;
setTimeout(function(){
value = true;
}, 1998);
// code
function promiseWhen(condition, timeout){
if(!timeout){