Skip to content

Instantly share code, notes, and snippets.

View vasi's full-sized avatar

Dave Vasilevsky vasi

  • Montreal
View GitHub Profile
@vasi
vasi / vasi-tools.md
Last active January 27, 2016 20:38 — forked from dergachev/alex-tools.md
The tools I use.

Tools we use for PM for project management and communication

  • git for code and structured docs
  • dropbox for screenshots and file sharing
  • markdown (in github) and textile (in redmine)
  • markdown for presentations
  • TextMate and Atom for text editing
  • MacDown for markdown editing

Development:

id: shows
migration_tags: { }
label: 'TV shows'
source:
plugin: json_source
path: 'http://api.tvmaze.com/search/shows?q=family'
identifier: id
identifierDepth: 1
headers: { }
fields: { }
<?php
// Helper for executing migrations in D8, without migrate_tools.
$args = drush_get_arguments();
array_splice($args, 0, 2);
$cmd = array_shift($args);
switch ($cmd) {
case 'mi':
use std::rc::Rc;
use std::cell::RefCell;
use std::ops::DerefMut;
struct A<'a> {
pub v: Vec<Rc<RefCell<FnMut() + 'a>>>,
}
impl<'a> A<'a> {
pub fn add3<F: FnMut() + 'a>(&mut self, f: F) {
let r = Rc::new(RefCell::new(f));
@vasi
vasi / mdns.pl
Created October 3, 2016 21:55
mDNS in pure Perl, no extra modules needed
#!/usr/bin/perl
use warnings;
use strict;
use IO::Select;
use IO::Socket::INET;
# Build an mDNS query.
sub build_query {
my $domain = shift;
@vasi
vasi / toggl2rm.rb
Created December 9, 2016 03:04
Import time logs from Toggl to Redmine
#!/usr/bin/ruby
require 'date'
require 'json'
require 'net/http'
require 'openssl'
require 'optparse'
require 'ostruct'
require 'pp'
def req(url, method = :Get)
@vasi
vasi / uuid.php
Last active November 11, 2021 15:23
Modify Drupal's config UUIDs to match a config dir
<?php
use Symfony\Component\Yaml\Yaml;
global $config_directories;
$config_name = drush_shift();
if (!isset($config_directories[$config_name])) {
print "No such config directory $config_name\n";
exit;
}
@vasi
vasi / dry_run.php
Created March 30, 2017 19:12
Drupal migrate dry run
<?php
use Drupal\migrate_plus\Event\MigrateEvents as MigratePlusEvents;
use Drupal\migrate_plus\Event\MigratePrepareRowEvent;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
function dry_run_migration($migration_id) {
// Get the migration source.
$migrationManager = \Drupal::service('plugin.manager.config_entity_migration');
$migration = $migrationManager->createInstance($migration_id);
@vasi
vasi / brewfoster
Created May 17, 2017 04:26
Manage a clean homebrew installation
#!/usr/bin/env ruby
require 'pathname'
require 'set'
require 'pp'
def dependencies
deps = {}
IO.popen(['brew', 'deps', '--installed']) do |f|
f.each do |line|
md = /^([^:]+):\s*(.*)$/.match(line) or raise "Can't parse dependencies"
@vasi
vasi / Results
Created May 25, 2017 06:26
Mac browser market share in last year, from Wikipedia
Safari 47.5
Chrome 40.6
Firefox 8.9
AppleMail 2.6
Other 0.3
PhantomJS 0.0
Camino 0.0
WebKit Nightly 0.0