Skip to content

Instantly share code, notes, and snippets.

View newtriks's full-sized avatar

Simon Bailey newtriks

View GitHub Profile
@newtriks
newtriks / actionscript.sublime-build
Created July 17, 2012 18:27
SublimeText2 MXMLC compile and run buildfile
{
"cmd": ["/Users/newtriks/Library/Plugins/sdks/flex_sdk_4.6.0.23201B/bin/mxmlc",
"$file",
"-static-link-runtime-shared-libraries=true"],
"file_regex": "(.*)[(](\\d+)[)]:(?: col: (?:\\d+))? *Error: (.*)",
"selector": "source.actionscript",
"variants": [
{ "cmd": ["open ${file_path}/${file_base_name}.swf"],
"shell": true,
"name": "Run"
@newtriks
newtriks / file.js
Created February 6, 2014 18:35
NodeJS module to download multiple files from Amazon S3
#!/usr/bin/env node
var Q = require('q'),
FS = require('fs'),
PB = require('progress'),
AWS = require('aws-sdk'),
conf = new require('../config')();
AWS.config.update(conf.aws_credentials);
@newtriks
newtriks / version.sh
Created October 18, 2012 12:46
Versioning a Rails app with Git and Heroku
#!/bin/bash
REVISION=$(heroku config:get REVISION)
echo " info: heroku REVISION: $REVISION"
function version_release
{
echo -e " info: writing: '\$tagged_release_version = \"$1\"' to version_helper.rb"
echo -e "\$tagged_release_version = \"$1\"" > config/initializers/version_helper.rb
git add config/initializers/version_helper.rb
git commit -am "Updating version_helper with latest tagged version $1"
echo " info: deployed version $REVISION is not yet tagged; tagging now as $1"
@newtriks
newtriks / app.js
Last active September 5, 2018 06:09
Playing with immutable state using RxJS
import {List, Record, toJS} from 'immutable';
import Rx, {Observable, Subject} from 'rx';
const initialState = Record({count: 0, text: '', items: List(), history: List(), future: List()});
const subject = new Subject();
const source = Observable.merge(subject)
.scan((currentState, action) => action(currentState), initialState());
source.subscribe(
state => {
@newtriks
newtriks / flex.sublime-build
Created January 7, 2013 20:32
Sublime flex build file for mxmlc compilation
{
"cmd": [
"/Users/newtriks/Library/Developer/SDK/flex_sdk_4.6.0.23201B/bin/mxmlc",
"$file",
"-static-link-runtime-shared-libraries=false",
"-load-config+=${file_path}/../config.xml",
"-keep-as3-metadata+=Inject",
"-keep-as3-metadata+=PostConstruct",
"-allow-source-path-overlap=true",
"-locale=en_US",
@newtriks
newtriks / index.js
Created December 11, 2017 18:43 — forked from bahmutov/index.js
Kleisli composition example (JSON parsing + deep property)
// following along https://medium.com/@luijar/kliesli-compositions-in-javascript-7e1a7218f0c4
const R = require('ramda')
const Maybe = require('ramda-fantasy').Maybe
// parse JSON string into object
// parse :: String -> Object | Null
function parse(s) {
try {
return JSON.parse(s)
} catch (e) {
@newtriks
newtriks / webpack.config.production.js
Created November 21, 2017 16:02 — forked from DavidLazic/webpack.config.production.js
Webpack production config
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const autoprefixer = require('autoprefixer');
@newtriks
newtriks / webpack.config.production.js
Created November 21, 2017 16:02 — forked from DavidLazic/webpack.config.production.js
Webpack production config
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const StyleExtHtmlWebpackPlugin = require('style-ext-html-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const autoprefixer = require('autoprefixer');
@newtriks
newtriks / image_scraper.rb
Created April 3, 2013 16:25
Sinatra script to scrape a specific xml file for image urls and upload the linked images to an Amazon S3 bucket. Change to suit your particular XML nodes.
#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra'
require 'haml'
require 'nokogiri'
require 'aws/s3'
set :bucket, 'bucket-name'
set :s3_key, 'xxxxxx'
set :s3_secret, 'xxxxxx'