Skip to content

Instantly share code, notes, and snippets.

@chriselsner
chriselsner / nix-on-macos-catalina.md
Last active September 19, 2024 00:46
Nix on macOS Catalina

Nix on macOS Catalina

I'm writing this gist for my own records but it might help someone else too.

Installing Nix

Support for Catalina has improved a lot since the update was first rolled out.

Note: See the NixOS manual for discussion of the --darwin-use-unencrypted-nix-store-volume option.

@expelledboy
expelledboy / uninstall-nix-osx.sh
Last active October 6, 2024 07:10
Trying Nix
#!/bin/bash
# !!WARNING!!
# This will DELETE all efforts you have put into configuring nix
# Have a look through everything that gets deleted / copied over
nix-env -e '.*'
rm -rf $HOME/.nix-*
rm -rf $HOME/.config/nixpkgs
@yepitschunked
yepitschunked / extractOrientation.js
Created October 19, 2016 22:25
extract image orientation from exif
export function extractOrientation(imgBlob) {
// written based on https://www.media.mit.edu/pia/Research/deepview/exif.html
// the exif orientation values are pretty nonsensical.
const orientationValueToRotateDegrees = {
1: 0,
3: 180,
6: 90,
8: 270,
};
@jeradg
jeradg / ember-data-model-mock.js
Created March 3, 2016 19:46
Mock ember-data object factory - Use mirage fixtures (or any other plain old JS object) to mock Ember Data models in component integration tests. See also ember-cli-mirage-object-factory.js - https://gist.github.com/jeradg/6043ba31d831633ce4e3
// tests/helpers/model-mock.js
export function modelMock(attrs) {
const emberDataRecordAttrs = {
isValid: true,
isNew: false
};
return Ember.Object.extend(emberDataRecordAttrs)
.create(attrs);
}
@jeradg
jeradg / ember-cli-mirage-object-factory.js
Last active March 3, 2016 19:47
ember-cli-mirage Ember.Object factory - Use mirage factories to mock Ember Data models in component integration tests. See also ember-data-model-mock.js: https://gist.github.com/jeradg/6f8bfbbf0722d34eea09
/*
* Decorator on a Mirage plain-ol'-JavaScript-object factory
* to allow you to create Ember objects.
*
* The objects act just enough like an Ember Data model that
* you can use them as a drop-in replacement for DS.Model instances
* in many component integration tests.
*
* Returns an object with one method, `create`, that returns
* subclasses of Ember.Object that are created with the Mirage
@migbar
migbar / ember-cli-page-object-extensions.js
Last active November 27, 2020 05:09
ember-cli-page-object extension for ember-power-select
// helpers/ember-cli-page-object-extensions.js
import { buildSelector } from '../page-object';
let selectableChoose = function(selector, options = {}) {
return {
isDescriptor: true,
value(textToSelect) {
wait().then(function() {
@jeremywrowe
jeremywrowe / .projections.json
Last active August 20, 2017 19:10 — forked from chantastic/.projections.json
ember-cli VIM projections
{
"app/adapters/*.js": {
"command": "adapter",
"template": [
"import ApplicationAdapter from './application';",
"",
"export default ApplicationAdapter.extend({",
"",
"});"
],
@samselikoff
samselikoff / future-proof.md
Last active August 15, 2024 15:17
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
@timrwood
timrwood / dirty-helpers.js
Created November 9, 2014 00:13
Ember Data Dirty Relationships Mixins
import Ember from 'ember';
export { dirtyHasMany, dirtyBelongsTo, dirtyMixin };
var dirty = 'relationshipIsDirty';
function dirtyMixin (obj) {
var args = Object.keys(obj);
var comp = Ember.computed;
args.push('isDirty');
obj[dirty] = comp.any.apply(comp, args);
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d