Skip to content

Instantly share code, notes, and snippets.

View bitamar's full-sized avatar

Itamar Shapira Bar-Lev bitamar

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
diff --git a/plugins/destinations/term.inc b/plugins/destinations/term.inc
index f01c55f..37641a4 100644
--- a/plugins/destinations/term.inc
+++ b/plugins/destinations/term.inc
@@ -224,7 +224,7 @@ class MigrateDestinationTerm extends MigrateDestinationEntity {
}
$this->prepare($term, $row);
- if (empty($term->name)) {
+ if ($term->name == '') {
<Directory "/Users/itamar/Sites" >
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Require local
</Directory>
<VirtualHost *:80>
VirtualDocumentRoot /Users/itamar/Sites/%1/www
</VirtualHost>
@bitamar
bitamar / add_swap.sh
Last active February 7, 2016 08:11
Add swap to ubuntu 14.04
# Add a 1G swap to swapless ubuntu server. (Verify with: free -m)
# Adapted from https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sysctl vm.swappiness=10
echo vm.swappiness=10 >> /etc/sysctl.conf
@bitamar
bitamar / pantheon-get-db
Last active August 29, 2015 14:20
WIP: Download and import a drupal database from pantheon cli (Terminus)
#!/usr/bin/env bash
EMAIL="mail@example.com"
SITE="mypantheonsite"
ENVIRONMENT="live"
terminus auth login $EMAIL
terminus site backup create --site=$SITE --env=$ENVIRONMENT --element=database
DUMPURL=`terminus site backup get --site=$SITE --env=$ENVIRONMENT --element=database --latest`
@bitamar
bitamar / nginx.conf
Last active August 29, 2015 14:14 — forked from leon/nginx.conf
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@bitamar
bitamar / wikilipsum.js
Last active August 28, 2021 12:19
Fetch a random wikipedia article and save it as plain-text (For a sample jekyll site).
/**
* Wikilipsum - Fetch a random article from Wikipedia and store it as a jekyll article.
*
* itamar@gizra.com
*/
var request = require("request");
var htmlToText = require("html-to-text");
var fs = require("fs");
int add_operand_lines (char *operand, char *operand_offset, int work_on_src, int i, int line_num, int addr) {
switch (addr) {
case 0:
if ((!commands[i].src_imidiate_address && work_on_src) || (!commands[i].dest_imidiate_address && !work_on_src)) {
error_set("Error", "Illegal address.", line_num);
return 0;
}
IC++;
line_data = New(LineData);
/**
* Profile task; Attach OG related fields.
*/
function kaveret_og_setup() {
// Group type.
og_create_field(OG_GROUP_FIELD, 'node', 'community');
// Group content type
$bundles = array(
@bitamar
bitamar / gist:4978059
Created February 18, 2013 15:06
garmentbox_migrate.migrate.field_collection_destination.inc
<?php
/**
* Destination class implementing migration into field_collection.
*/
class garmentboxMigrateDestinationFieldCollection extends MigrateDestinationEntity {
/**
* The type of entity hosting this collection field (e.g., node).
*