Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pixelhandler
pixelhandler / ember-cli-upgrade-1.13.8-to-1.13.13.sh
Last active December 6, 2015 22:49
Bash script to update dependencies (based on release notes) for an ember-cli app or addon, v1.13.8 -> v1.13.13
#!/usr/bin/env bash
# Use with arg $1 as --app or --addon and optional arg $2 as --backup to keep a copy of the original files
#
# Upgrade Ember-CLI dependencies from 1.13.8 to 1.13.13
#
# - https://github.com/twokul/ember-cli-release-notes/commit/1cee41eb91bf7c534917fdd4cd42a1cd1a481c75
# - https://github.com/ember-cli/ember-cli/releases/tag/v1.13.12
# - https://github.com/ember-cli/ember-cli/releases/tag/v1.13.13
@robmiller
robmiller / archive-github.rb
Created October 27, 2015 12:43
Clones a GitHub repository locally, and then deletes it from GitHub. Useful for cleaning up no-longer-needed private repos. Usage: archive-github OWNER REPO_NAME
#!/usr/bin/env ruby
#
# archive-github
#
# Author: Rob Miller <r@robm.me.uk>
#
# Clones a GitHub repository locally, and then deletes it from GitHub.
# Useful for cleaning up no-longer-needed private repos.
#
# Assumes you have an OAuth token stored in an environment variable
@searls
searls / gloan.sh
Last active August 20, 2018 15:22
Clone into a new repo and quickly switch into it. Helps avoid a haphazard collection of unorganized github repos all over my home directory. Once it's cloned (or even if it errors), just hit Paste & it'll change into the directory of the repo.
#!/bin/sh -e
# A simple script to keep a tidy ~/code directory organized by owner & then repo
# When the script is done, just hit command-v to switch into the directory
# (Github and Mac only. Sorry, openness!)
#
# Usage:
# gloan <org>/<repo>
# Or:
# gloan <org> <repo>
@searls
searls / duplicate-retro-rasterized-keynote-slides.scpt
Created October 20, 2015 11:27
Will export the top-level keynote document to one-image-per-build, then downsize to 640x480, then upscale back to 1024x768, then create a new keynote document of one slide per image. Yes, really.
tell application "Keynote"
activate
if playing is true then tell the front document to stop
if not (exists document 1) then error number -128
display dialog "This script will export the front presentation as images and then create a new presentation containing the exported images." & return & return & "Slide transitions and presenter notes will be transfered from the source presentation." with icon 1
-- STORE INFORMATION ABOUT FRONT DOCUMENT
tell front document
@steveklabnik
steveklabnik / summary.md
Created September 29, 2015 14:39
my summary of "using Rust with Ruby: a deep dive with Yehuda Katz"

My summary of https://www.youtube.com/watch?v=IqrwPVtSHZI

TL;DR:

Rails has a library, ActiveSupport, which adds methods to Ruby core classes. One of those methods is String#blank?, which returns a boolean (sometimes I miss this convention in Rust, the ?) if the whole string is whitespace or not. It looks like this: https://github.com/rails/rails/blob/b3eac823006eb6a346f88793aabef28a6d4f928c/activesupport/lib/active_support/core_ext/object/blank.rb#L99-L117

It's pretty slow. So Discourse (which you may know from {users,internals}.rust-lang.org) uses the fast_blank gem, which provides this method via a C implementation instead. It looks like this: https://github.com/SamSaffron/fast_blank/blob/master/ext/fast_blank/fast_blank.c

For fun, Yehuda tried to re-write fast_blank in Rust. Which looks like this:

@mlen
mlen / gen.rb
Last active October 9, 2015 08:44
quine generator in ruby
head = "#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
char *s = "
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@yyolk
yyolk / index.js
Last active September 29, 2018 02:28 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@eddiejaoude
eddiejaoude / most-active-users-on-github-2015.md
Last active November 30, 2017 10:30
Most active users on GitHub 2015

This is the top 1000 users on GitHub

Where are you on here?

For the first 6 months of 2015 (Jan - June).

Query used on Google's BigQuery with GitHubArchive Data

SELECT actor.login as user, COUNT(*) as total FROM (
@qrush
qrush / security.md
Last active August 29, 2015 14:24
Package manager service surveys. Additions/corrections welcome.