Skip to content

Instantly share code, notes, and snippets.

James Harton jimsynz

Block or report user

Report or block jimsynz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@praveenperera
praveenperera / webpack.config.babel.js
Last active Dec 20, 2017
Webpack 2.0+ with Phoenix 1.3+ (Elixir)
View webpack.config.babel.js
import webpack from "webpack";
import ExtractTextPlugin from "extract-text-webpack-plugin";
import CopyWebpackPlugin from "copy-webpack-plugin";
import WebpackNotifierPlugin from "webpack-notifier";
import path from "path";
const ENV = process.env.NODE_ENV || "development";
const IS_PROD = ENV === "production";
const OUTPUT_PATH = path.resolve(__dirname, "..", "priv", "static");
@DiogoAndre
DiogoAndre / gist:8f5cc66024217d34c465
Last active May 12, 2018
Use font icon to create a NSMutableAttributedString in RubyMotion
View gist:8f5cc66024217d34c465

Get the font files from http://octicons.github.com and copy the octicons-local.ttf file to the /resources directory at the root of your project.

my_icon = NSMutableAttributedString.alloc.initWithString("\uf00e")
my_icon.addAttribute(NSFontAttributeName, value: NSFont.fontWithName("github-octicons",size:30), range: NSMakeRange(0, 1))

The string in initWithString will be the unicode value of the char that represents the icon you want. You can check the unicode value for the icons in the CSS file that comes when you download the font.You can also get the unicode value when you select an icon on octicons.github.com.

@tomriley
tomriley / mongiod_mysql_migrator.rb
Created Apr 10, 2014
Migrate a Mongoid / MongoDB database to an ActiveRecord based SQL one. One method to convert the schema, another to migrate data. Copes with most basic data types. Some hacks to infer TEXT columns. Converts embeds_one relationships to AR aggregations. I wrote this for a one-time migration. It could be a good starting point for someone doing the …
View mongiod_mysql_migrator.rb
# Migrate schema and data from Mongoid to MySQL ActiveRecord
class MongoidMysqlMigrator
def randomize_auto_increment_values(source_models, from=5500, to=10500)
source_models.each do |model|
value = rand(from-to)+from
sql = %(ALTER TABLE #{model.name.tableize} AUTO_INCREMENT=#{value})
puts sql
ActiveRecord::Base.connection.execute(sql)
end
@ghempton
ghempton / gist:9882197
Created Mar 30, 2014
EPF Adapter URL API
View gist:9882197
Adapter.map(function() {
this.resources('post', {path: '/blog-posts/:post_id'}, function() {
this.resources('comments'); // assumes has-many called 'comments' and inverse called 'post'
this.resource('owner', {type: 'user'});
});
});
@maoueh
maoueh / gist:8260199
Last active Jan 14, 2020
OpenELEC (4.0.1) WIFI connection details using `connman`
View gist:8260199

Even though there is a nice XBMC add-on to configure your WIFI settings, sometimes, you may still want to setup the WIFI connection for many reasons or just for fur.

OpenELEC use connman for managing connection to the various available network.

Setuping connman to connect to your protected WIFI network is an easy requiring you only to create a config file and enter some commands in a shell.

@tomdale
tomdale / gist:1856842
Created Feb 18, 2012
Ember documentation TODO
View gist:1856842

Documentation

TODO

  • API docs
  • How to bootstrap a project
  • Application structure (M/V/C layers and what they're for)
  • Getting started with Ember and Rails
  • Built-in controls
  • How events are handled and bubbled
View regex-weburl.js
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
You can’t perform that action at this time.