Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
iOS, Capacitor, Ember, Vue, Rails

Benjamin Borowski typeoneerror

🤠
iOS, Capacitor, Ember, Vue, Rails
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am typeoneerror on github.
  • I am typeoneerror (https://keybase.io/typeoneerror) on keybase.
  • I have a public key whose fingerprint is BFC5 50E7 C93F 53F9 F9F4 C1F9 0011 F06C CD8A 1AFE

To claim this, I am signing this object:

@typeoneerror
typeoneerror / video_id_from_youtube_url.php
Created May 6, 2014
Simple function for matching any youtube link and grabbing the ID
View video_id_from_youtube_url.php
if (!function_exists('video_id_from_youtube_url')):
function video_id_from_youtube_url($source)
{
$pattern = '/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/)?([\w\-]+))/is';
$matches = array();
preg_match($pattern, $source, $matches);
if (isset($matches[1])) return $matches[1];
return false;
}
View gist:19152acb1070b024605f
// TODO: watch for renaming of files or adding/deleting files
// Requirements
var gulp = require('gulp')
, changed = require('gulp-changed')
, clean = require('gulp-clean')
, coffee = require('gulp-coffee')
, compass = require('gulp-compass')
, concat = require('gulp-concat')
, minifyCSS = require('gulp-minify-css')
@typeoneerror
typeoneerror / 1. bad.js
Last active Aug 29, 2015
ember.js property oopsie
View 1. bad.js
queryParams: ['draft'],
draft: null,
courses: function() {
isDraft = this.get('draft');
return this.get('model').filterBy('isDraft', isDraft).sortBy('name');
}.property('draft'); // courses are filtered when draft query param changes
@typeoneerror
typeoneerror / indexes.emblem
Created Oct 30, 2014
volatile properties with ember.js
View indexes.emblem
App.AdminAccountIndexController = Ember.Controller.extend
_tabIndex: 0
tabIndex: (->
@incrementProperty('_tabIndex')
@get('_tabIndex')
).property('_tabIndex').volatile()
@typeoneerror
typeoneerror / sortable.rb
Created Nov 15, 2014
Concern for PostgreSQL sort records by ID in one query
View sortable.rb
module DokiCore
module Concerns
module Sortable
extend ActiveSupport::Concern
module ClassMethods
# Run a "single" query to update multiple records by position.
#
# The Array of passed in IDs are sorted in the order they are
@typeoneerror
typeoneerror / run-backend.sh
Last active Aug 29, 2015
run all the things
View run-backend.sh
#!/bin/bash
# backend/run
echo -n -e "\033]0;Rails\007"
foreman start
echo -n -e "\033]0;\007"
View .gitconfig
[alias]
st = status
nl = log --oneline
br = branch
co = checkout
ds = diff --staged
di = diff
fetchall = fetch -v --all
logf = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
logm = log --author=USERNAME --pretty=format:'%h %cd %s' --date=short
View .ember-cli
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.
Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"skipGit": true,
"disableAnalytics": true,
"liveReload": true,