Skip to content

Instantly share code, notes, and snippets.

Tomasz Szopiński czterystaczwarty

Block or report user

Report or block czterystaczwarty

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
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
activity: undefined,
periods: Ember.A(),
duration: Ember.computed.sum('periods'),
lastResumeTimestamp: undefined,
isStarted: Ember.computed.notEmpty('periods'),
isRunning: false,
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
czterystaczwarty /
Created Mar 8, 2016 — forked from chadmaughan/
A git pre commit hook that runs the test task with the gradle wrapper
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/ pre-commit
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'
czterystaczwarty / .gitconfig
Created Sep 18, 2015
List branches by date
View .gitconfig
recentbranches = "!sh -c \"git for-each-ref --sort='committerdate' --format='%(color:green)%(committerdate:short) %(color:yellow)%(refname)' refs/heads | sed -e 's-refs/heads/--'\""
rb = "!sh -c 'git recentbranches'"
View getAbsoluteUrl.js
var getAbsoluteUrl = (function() {
var a;
return function(url) {
if(!a) a = document.createElement('a');
a.href = url;
return a.href;
czterystaczwarty / once.js
Created Sep 16, 2015
The `once` function ensures a given function can only be called once, thus prevent duplicate initialization!
View once.js
function once(fn, context) {
var result;
return function() {
if(fn) {
result = fn.apply(context || this, arguments);
fn = null;
return result;
czterystaczwarty / poll.js
Created Sep 16, 2015
Check for desired state at intervals.
View poll.js
function poll(fn, callback, errback, timeout, interval) {
var endTime = Number(new Date()) + (timeout || 2000);
interval = interval || 100;
(function p() {
// If the condition is met, we're done!
if(fn()) {
// If the condition isn't met but the timeout hasn't elapsed, go again
czterystaczwarty / debounce.js
Last active Sep 16, 2015
The `debounce` function will not allow a callback to be used more than once per given time frame. This is especially important when assigning a callback function to frequently-firing events.
View debounce.js
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
czterystaczwarty /
Created Aug 21, 2015
Replace tag in xml and push to stodout
xmlstarlet edit -u '//requestNumber' -v '1234567' /tmp/rejectCustomer_pl.soap
You can’t perform that action at this time.