Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Merrill nick-merrill

  • Wayfair
  • Boston, MA
View GitHub Profile
@marty-wang
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active Jan 7, 2021
Compile and deploy React Native Android app of Release version to device.
View gist:5a71e9d0a6a2c6d6263c
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
@jokester
jokester / PixelExtractor.swift
Last active Jan 18, 2021
extract pixel from a CGImage
View PixelExtractor.swift
// extract pixel from a CGImage
/* use case:
let extractor = PixelExtractor(img: UIImage(named: "gauge_vertical")!.CGImage!)
let color = extractor.color_at(x: 10, y: 20)
*/
class PixelExtractor {
// taken from http://stackoverflow.com/questions/24049313/
// and adapted to swift 1.2
@trcook
trcook / autocommit.sh
Created Feb 3, 2015
auto commit git. use fswatch to setup a file to auto-commit a git repo on file change
View autocommit.sh
#!/bin/bash
# requires fswatch
fswatch -o . -e "\\.git.*"| xargs -n1 -I{} git commit -am "snapshot from autocommit_script.sh"
@maebert
maebert / latest_topic.txt
Last active Aug 29, 2018
Get notified when somebody posts a new topic in a forum
View filterable.rb
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call
View meteor
# Ubuntu upstart file at /etc/init/meteor.conf
author "Tom Coleman <tom@thesnail.org>"
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 10 5
@bhollis
bhollis / blog.js.coffee
Last active Jun 4, 2020
A simple, made-up example of the code for a simple AngularJS blog viewer as a more detailed exploration of http://benhollis.net/blog/2014/01/17/cleanly-declaring-angularjs-services-with-coffeescript/ . Yes, I know about `$resource`, but I prefer not to use it.
View blog.js.coffee
app = angular.module 'BlogExample', []
# Simple controller that loads all blog posts
app.controller 'BlogCtrl', ['$scope', 'Blog', ($scope, Blog) ->
# Get all the blog posts
Blog.all().then (posts) ->
$scope.posts = posts
# Extend the $scope with our own properties, all in one big block
# I like this because it looks like declaring a class.
@burnash
burnash / get_oauth2_token.py
Last active Nov 3, 2019
Simple command line script to fetch a Google API's access token.
View get_oauth2_token.py
'''
This script will attempt to open your webbrowser,
perform OAuth 2 authentication and print your access token.
It depends on two libraries: oauth2client and gflags.
To install dependencies from PyPI:
$ pip install python-gflags oauth2client
@EpokK
EpokK / ngEnter.js
Last active Jul 22, 2020
ngEnter directive if you can use submit form(https://twitter.com/ririlepanda)
View ngEnter.js
app.directive('ngEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.ngEnter);
});
event.preventDefault();
}
@prebenlm
prebenlm / .A how to display Irssi-hilights in OS X Notification Center.md
Last active Aug 12, 2019
Guide: how to make irc messages in a screen on a remote server appear in your Mac OS X Lion Notification Center with the help of terminal-notifier
View .A how to display Irssi-hilights in OS X Notification Center.md

Irssi in Mac OS X Notification Center

Mou icon

Overview

This guide will explain how you can make irc messages in a screen on a remote server appear in your Mac OS X Lion Notification Center with the help of terminal-notifier.

We will also explain how the process can be automatically started each time you log in to your Mac and ensure the connection to the server is kept alive.