Skip to content

Instantly share code, notes, and snippets.

View notcher.js
var makerjs = require('makerjs')
// Model of pixel heart created by another script, hard-coded here for use in maker playground
var pixel_heart = {"paths":{"ShapeLine1":{"type":"line","origin":[0,9],"end":[1,9]},"ShapeLine2":{"type":"line","origin":[1,9],"end":[1,10]},"ShapeLine3":{"type":"line","origin":[1,10],"end":[2,10]},"ShapeLine4":{"type":"line","origin":[2,10],"end":[2,11]},"ShapeLine5":{"type":"line","origin":[2,11],"end":[5,11]},"ShapeLine6":{"type":"line","origin":[5,11],"end":[5,10]},"ShapeLine7":{"type":"line","origin":[5,10],"end":[8,10]},"ShapeLine8":{"type":"line","origin":[8,10],"end":[8,11]},"ShapeLine9":{"type":"line","origin":[8,11],"end":[11,11]},"ShapeLine10":{"type":"line","origin":[11,11],"end":[11,10]},"ShapeLine11":{"type":"line","origin":[11,10],"end":[12,10]},"ShapeLine12":{"type":"line","origin":[12,10],"end":[12,9]},"ShapeLine13":{"type":"line","origin":[12,9],"end":[13,9]},"ShapeLine14":{"type":"line","origin":[13,9],"end":[13,6]},"ShapeLine15":{"type":"line","origin":[13,6
View notcher.js
var makerjs = require('makerjs')
// Model of pixel heart created by another script, hard-coded here for use in maker playground
var pixel_heart = {"paths":{"ShapeLine1":{"type":"line","origin":[0,9],"end":[1,9]},"ShapeLine2":{"type":"line","origin":[1,9],"end":[1,10]},"ShapeLine3":{"type":"line","origin":[1,10],"end":[2,10]},"ShapeLine4":{"type":"line","origin":[2,10],"end":[2,11]},"ShapeLine5":{"type":"line","origin":[2,11],"end":[5,11]},"ShapeLine6":{"type":"line","origin":[5,11],"end":[5,10]},"ShapeLine7":{"type":"line","origin":[5,10],"end":[8,10]},"ShapeLine8":{"type":"line","origin":[8,10],"end":[8,11]},"ShapeLine9":{"type":"line","origin":[8,11],"end":[11,11]},"ShapeLine10":{"type":"line","origin":[11,11],"end":[11,10]},"ShapeLine11":{"type":"line","origin":[11,10],"end":[12,10]},"ShapeLine12":{"type":"line","origin":[12,10],"end":[12,9]},"ShapeLine13":{"type":"line","origin":[12,9],"end":[13,9]},"ShapeLine14":{"type":"line","origin":[13,9],"end":[13,6]},"ShapeLine15":{"type":"line","origin":[13,6
View endpoints.js
/**
____ _ ____ ____ ____
/ ___| / \ | _ \ | _ \ / ___|
| | / _ \ | |_) | | | | | \___ \
| |___ / ___ \ | _ < | |_| | ___) |
\____| /_/ \_\ |_| \_\ |____/ |____/
*/
app.get('/cards', function (req, res) {
AdminAPI.getCards(req);
@objectiveSee
objectiveSee / curl.json
Created Dec 22, 2015
curl http://localhost:9200/_nodes/jvm?pretty.json
View curl.json
{
"cluster_name" : "elasticsearch",
"nodes" : {
"QbEzXa1MRoOoupjNELMwlw" : {
"name" : "Zzzax",
"transport_address" : "inet[/10.0.0.240:9300]",
"host" : "ip-10-0-0-240",
"ip" : "10.0.0.240",
"version" : "1.4.0",
"build" : "bc94bd8",
View input
{
duck:true,
"french":"fries"
}
View foo.java
ArrayList<String> cardIds = new ArrayList<>();
for (CardView.CardInfo c : cardsToDiscard) {
cardIds.add(c.getId());
}
bindFragmentLifecycle(lifecycle(),
gameManager.discardCards(game.getGameId(), cardIds)).observeOn(
AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
@Override public void call(JSON json, ERROR error) {
View view = getView();
if (view == null) return;
View relay.cpp
#include <Arduino.h>
#include "Relay.h"
// Relay is active low, so you need a 0 to turn it on.
#define RELAY_ON 0
#define RELAY_OFF 1
Relay::Relay( int whatPin )
{
// initialize variables
View gist:9d3c51edea493b85c120
## EVILBASE %{TIMESTAMP_ISO8601:pickles} - %{LOGLEVEL:level}:
grok {
match => { "message" => "%{EVILBASE}%{GREEDYDATA}" }
}
date {
match => [ "pickles" , "ISO8601" ]
}
@objectiveSee
objectiveSee / ssh.pl
Last active Aug 29, 2015
usage: ./ssh.pl or ./ssh.pl <index of host>
View ssh.pl
#!/usr/bin/perl
use strict;
use warnings;
# Read SSH config
my $filename = '/Users/<your user>/.ssh/config';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
View gist:f46d8e0a857288c4d3a1
#import "DRBlocks.h"
@interface DRBlocks ()
@property (nonatomic) NSMutableDictionary *blocksHash;
@end
@implementation DRBlocks
- (instancetype)init
{