Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
-- Toggable tray, for those who don't like to see it all the time. | |
-- http://awesome.naquadah.org/wiki/Minitray | |
-- Usage: after requiring a module, bind minitray.toggle() to a key. | |
local wibox = require("wibox") | |
-- Module minitray | |
local minitray = { geometry = {} } | |
local function show() |
#!/usr/bin/env ruby | |
require 'bundler' | |
changelog_file = 'CHANGELOG' | |
entries = "" | |
helper = Bundler::GemHelper.new(Dir.pwd) | |
current_version = "v#{helper.gemspec.version}" | |
starting_version = nil |
Let's have some command-line fun with curl, [jq][1], and the [new GitHub Search API][2].
Today we're looking for:
# for more information look at help.github.com/capistrano/ | |
set :application, "yii2-app-basic" | |
server "example.com", :web # your server address or IP | |
set :user, "username" # your username for ssh | |
set :use_sudo, false | |
# set the remote directory you're going to deploy to | |
set :deploy_to, "/home/#{user}/www/#{application}" | |
# disable rails specific normalize_assets property |
#!/bin/sh | |
##################################### | |
# PHP Installer # | |
# Written For Centos 5.x # | |
##################################### | |
# Author: Sandeep Sangamreddi # | |
# URL: gleez.com # | |
# GitHub: github.com/sandeepone # | |
##################################### |
<?php | |
use Guzzle\Http\Client; | |
require __DIR__ . '/vendor/autoload.php'; | |
$tmpFile = tempnam(sys_get_temp_dir(), 'guzzle-download'); | |
$handle = fopen($tmpFile, 'w'); | |
$client = new Client('', array( | |
Client::CURL_OPTIONS => array( |
This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array
it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array
part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't:
set :application, "AppName" | |
set :repository, "[email protected]:path/toRepo.git" | |
set :deploy_to, "/app/appname" | |
set :deploy_via, :copy | |
set :stage_dir, "config/stages" | |
set :current_dir , "www" | |
set :default_stage, "dev" | |
set :stages, %w(dev testing prod) | |
set :use_sudo, false |
<?php | |
/** | |
* Get the hash of the current git HEAD | |
* @param str $branch The git branch to check | |
* @return mixed Either the hash or a boolean false | |
*/ | |
function get_current_git_commit( $branch='master' ) { | |
if ( $hash = file_get_contents( sprintf( '.git/refs/heads/%s', $branch ) ) ) { | |
return $hash; | |
} else { |
!! Appearance | |
urxvt.termName: rxvt-unicode | |
urxvt.scrollBar: false | |
urxvt.background: black | |
urxvt.foreground: gray | |
!! Font prefferenes | |
urxvt.font: xft:DejaVu Sans Mono:pixelsize=13 | |
urxvt.boldFont: xft:DejaVu Sans Mono:pixelsize=13:weight=bold | |
urxvt.letterSpace: -1 | |
!! Larger history limit |