Skip to content

Instantly share code, notes, and snippets.

View poteto's full-sized avatar
🥔
ポテト

lauren poteto

🥔
ポテト
View GitHub Profile
@poteto
poteto / gist:5997803
Created July 15, 2013 06:09
fix ubuntu weird mysql.sock path
$ ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic
#Refer: http://www.bomisofmab.com/blog/?p=100
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/
#Setup the rate control and delay
sudo tc qdisc add dev lo root handle 1: htb default 12
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms
#Remove the rate control/delay
sudo tc qdisc del dev lo root
speechSynthesis.getVoices().forEach(function(voice) {
var name = voice.name,
speech = new SpeechSynthesisUtterance("Hello, my name is " + name);
speech.voice = voice;
speechSynthesis.speak(speech);
});
@poteto
poteto / upgrade-mavericks-yosemite-rails.markdown
Last active December 12, 2016 14:58
Upgrading from Mavericks to Yosemite for Rails Devs

Upgrading from OSX Mavericks to OSX Yosemite (10.10)

Before upgrading to Yosemite, read this first, as your upgrade could potentially take a few hours if you have a large /usr folder. After the upgrade finishes, log in to OS X and install all updates in the App Store. Once the updates are done, do the following:

1. Install the latest Xcode CLT

xcode-select --install

2. Install Xcode 6.1

// Ideally you would set up a flash message service as a dependency injection
// (which can be a little involved), but here's a quick hack
// P.S. this was transpiled down from CoffeeScript, so it might look a bit funky
App.Post = DS.Model.extend({
errorMessages: Em.A([]),
didBecomeDirty: Em.observer('isDirty', function() {
return Em.run.debounce(this, '_handleSave', 500, true);
}),
_handleSave: function() {
@poteto
poteto / Default (OSX).sublime-keymap
Last active July 25, 2016 05:13
Sublime Packages
[
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+shift+'"], "command": "change_quotes" },
{ "keys": ["super+shift+a"], "command": "align_tab",
"args" : {"live_preview" : true}
},
{ "keys": ["super+shift+="], "command": "align_tab",
"args" : {"user_input" : "=/f"}
},
@poteto
poteto / highcharts-component.js
Last active March 2, 2016 20:43
Integrating Highcharts.js into Ember
App.HighChartsComponent = Ember.Component.extend(App.HighchartsThemeMixin, {
classNames: [ 'highcharts-wrapper' ],
content: undefined,
chartOptions: undefined,
chart: null,
buildOptions: Em.computed('chartOptions', 'content.@each.isLoaded', function() {
var chartContent, chartOptions, defaults;
chartOptions = this.getWithDefault('chartOptions', {});
chartContent = this.get('content.length') ? this.get('content') : [
@poteto
poteto / computed-properties.js
Last active August 29, 2015 14:09
Slack-like loading messages in an Ember app
var computed;
App.computed = {};
computed = Ember.computed;
App.computed.sample = function(dependentKey) {
return (computed("" + dependentKey + ".@each", function() {
var items, length;
items = this.getWithDefault(dependentKey, Em.A([]));
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['range-slider'],
value: 0,
attributeBindings: ['data-slider'],
'data-slider': 0,
valueDidChange: Em.observer('value', function(){
@poteto
poteto / search.js
Last active January 24, 2017 19:52
simple text search computed property macro
// utils/computed/search.js
import Ember from 'ember';
var computed = Ember.computed;
export default function search(dependentKey, propertyKey, searchQueryKey, returnEmptyArray) {
returnEmptyArray = (typeof returnEmptyArray === "undefined") ? false : returnEmptyArray;
return computed("" + dependentKey + ".@each." + propertyKey, searchQueryKey, function() {
var items, query;
if (returnEmptyArray && !this.get(searchQueryKey)) {
return Ember.A([]);