Skip to content

Instantly share code, notes, and snippets.

View alloy's full-sized avatar

Eloy Durán alloy

View GitHub Profile
@sibelius
sibelius / richTextToRelayRecordProxy.tsx
Created September 17, 2020 22:01
Transform an object to a Relay Record Proxy
export const richTextToRelayRecordProxy = (bodyRichText, store) => {
const bodyRichTextId = 'client:RichText:' + tempID++;
const bodyRichTextRecord = store.create(bodyRichTextId, 'RichText');
bodyRichTextRecord.setValue(bodyRichText.text, 'text');
bodyRichTextRecord.setValue(bodyRichText.html, 'html');
const { contentState } = bodyRichText;
if (contentState) {
const contentStateId = 'client:DraftContentState:' + tempID++;
@dnkoutso
dnkoutso / local_dependencies_source.rb
Created March 20, 2020 17:48
A CocoaPods source that discovers podspecs locally.
module Pod
class LocalDependenciesSource < Source
attr_reader :sandbox
attr_reader :local_podspecs_by_name
def self.register(plugin_name, sandbox, local_podspec_dependencies)
return unless local_podspec_dependencies
# Register a source that can be used to provide local podspecs
HooksManager.register(plugin_name, :source_provider) do |context|
@korchasa
korchasa / oss.md
Last active December 15, 2021 10:24
OSS homekit (without homebridge)
@HiImJulien
HiImJulien / Swift Meets CCxx.md
Last active March 30, 2024 19:00
This gist is a simple example on how to call a function written in swift from C/C++, without taking the detour via Objective-C/C++.

Swift Meets C/C++

This gist is a simple example on how to call a function written in swift from C/C++, without taking the detour via Objective-C/C++.


Analytics

In this example we're going to invoke a function called say_hello, which, as the name already suggests, prints "Hello, World!" to the terminal.

require "./src/sidekiq"
`redis-cli flushdb`
class LoadWorker
include Sidekiq::Worker
perform_types Int64
def perform(idx)
end

Rent The Runway - Docker D&D

Related blog post:

http://artsy.github.io/blog/2015/12/09/docker-for-development/

Reasons for using docker:

  • new developers have a setup that works without installing and configuring MongoDB, Solr, Elasticsearch, memcached, etc.
  • a docker-compose.yml file can provide the related services and environment variables an application needs.
// Copyright 2004-present Facebook. All Rights Reserved.
'use strict';
var SourceMapConsumer = require('source-map').SourceMapConsumer;
var fs = require('fs');
var argv = process.argv.slice(2);
if (argv.length < 2) {
console.error('Usage: ' + __filename + ' <source-map-file> <lineNumber> [column]');
process.exit(1);
#!/usr/bin/env ruby
require 'pathname'
code_files = ARGV
code_files.each do |file|
file = Pathname(file)
contents = file.read
contents.gsub!(/(^#import .*\n)+/) do |imports|
imports = imports.split("\n")
imports.sort.uniq.join("\n") << "\n"
@neonichu
neonichu / bump_xcode_plugin.sh
Created March 12, 2015 16:28
Quickly bump the compatibility UUID of a plugin in the CWD to the one of the currently selected Xcode.
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_id {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $1" "$2"
}
function has_id {
read_id DVTPlugInCompatibilityUUIDs *Info.plist|grep -q "$1"
@dougireton
dougireton / recruiter_response.md
Last active January 11, 2020 22:52
I've started responding to recruiters with this list of requirements

Company Requirements

I'm definitely not looking for work. However to provide some helpful guidance for hiring like-minded engineers, I would only consider working for a company if it met these requirements:

  1. Fewer than 250 employees.
  2. Concrete, measurable plan to increase the number of women and minorities in engineering roles.
  3. Commitment to using and contributing to open source.
  4. Collaborative, friendly atmosphere where pair programming is encouraged.
  5. Meaningful work with clear linkage between work and company goals.
  6. Demonstrated commitment to ethical business practices, e.g. B corp certification.