Skip to content

Instantly share code, notes, and snippets.

View typeoneerror's full-sized avatar
🤠
iOS, Capacitor, Ember, Vue, Rails

Benjamin Borowski typeoneerror

🤠
iOS, Capacitor, Ember, Vue, Rails
View GitHub Profile

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 17:18
Simple function for matching any youtube link and grabbing the ID
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;
}
// 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 August 29, 2015 14:07
ember.js property oopsie
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 October 30, 2014 00:57
volatile properties with ember.js
App.AdminAccountIndexController = Ember.Controller.extend
_tabIndex: 0
tabIndex: (->
@incrementProperty('_tabIndex')
@get('_tabIndex')
).property('_tabIndex').volatile()
@typeoneerror
typeoneerror / sortable.rb
Created November 15, 2014 22:30
Concern for PostgreSQL sort records by ID in one query
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 August 29, 2015 14:09
run all the things
#!/bin/bash
# backend/run
echo -n -e "\033]0;Rails\007"
foreman start
echo -n -e "\033]0;\007"
@typeoneerror
typeoneerror / .gitconfig
Created November 21, 2014 20:58
.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
@typeoneerror
typeoneerror / .ember-cli
Created November 30, 2014 23:41
.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,