Skip to content

Instantly share code, notes, and snippets.

View rootux's full-sized avatar
🌴
Crafting

Gal Bracha rootux

🌴
Crafting
View GitHub Profile
@rootux
rootux / Create_New_Dream_In_Cloud
Created January 10, 2017 17:09
Create a new dream folder and copy the budget file and send the link back - used with http://dreams.midburn.org
var dreamsPath = DriveApp.getFolderById('THE-ACTUAL-DRIVE-FOLDER-ID-CAN-BE-COPIED-FROM-URL');
var budgetTemplateFile = DriveApp.getFileById('THE-ACTUAL-DRIVE-BUDGET-FILE-ID-CAN-BE-COPIED-FROM-URL');
var budgetNewFileName = 'Budget - ';
function createDream(dreamerEmail, dreamId, dreamName) {
Logger.log("Got called with " + dreamerEmail +" " + dreamId + " " + dreamName);
var newFolder = createFolder_(dreamerEmail, dreamId,dreamName);
var templateFiles = copyTemplateFilesToFolder_(newFolder, dreamerEmail, dreamName);
var result = {};
result['id'] = newFolder.getUrl();
@rootux
rootux / Dockerfile
Last active February 17, 2017 17:18 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@rootux
rootux / on-scroll-to-bottom.directive.js
Last active April 6, 2017 19:57
Angular 1.5 - Calls a method when user scrolls to bottom
function OnScrollToBottom() {
'ngInject';
let spacing = 40;
return {
restrict: 'A',
link: function (scope, element, attrs) {
const fn = attrs.onScrollToBottom,
@rootux
rootux / hashtagLinky.js
Created May 1, 2017 11:46 — forked from rishabhmhjn/tweetLinky.js
This is an AngularJS filter to linkify #hashtags and @mention texts into respective Twitter URLsDemo - http://plnkr.co/edit/vrdgxU?p=preview
/* Based on https://gist.github.com/rishabhmhjn/7028079 */
function HashtagLinky($filter, $sce) {
'ngInject'
return function(text, target) {
if (!text) return text;
var replacedText = $filter('linky')(text, target);
var targetAttr = "";
if (angular.isDefined(target)) {
@rootux
rootux / bash_profile
Last active November 16, 2019 19:17
my Git ~./bash_profile and some more
alias gcd='git checkout development'
alias gc='git checkout'
alias gcb='git checkout -b'
alias gs='git status'
alias gb='git branch'
alias gcm='git checkout master'
alias gp='git pull'
alias gl='git log --oneline --decorate --graph'
alias gbdl='git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d'
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
@rootux
rootux / code.gs
Created September 18, 2017 23:59
Google Apps Script Undo function
/**
* Test function for onEdit. Passes an event object to simulate an edit to
* a cell in a spreadsheet.
* Check for updates: https://stackoverflow.com/a/16089067/1677912
*/
function test_onEdit() {
onEdit({
user : Session.getActiveUser().getEmail(),
source : SpreadsheetApp.getActiveSpreadsheet(),
range : SpreadsheetApp.getActiveSpreadsheet().getActiveCell(),
@rootux
rootux / firestore.rules
Created October 5, 2017 23:05
Firestore rules for TEAL based task app
service cloud.firestore {
match /databases/{database}/documents {
function isAdmin() {
return exists(/databases/$(database)/documents/admins/$(request.auth.uid));
}
function isUserAssigneeOrCreator() {
return request.auth.uid == resource.assignee.id
|| request.auth.uid == resource.creator.id;

Keybase proof

I hereby claim:

  • I am rootux on github.
  • I am galbracha (https://keybase.io/galbracha) on keybase.
  • I have a public key ASAjFQA1sDcEyyV_SfAQ3CVI7oMFer64JSeTSh2zcnJY_wo

To claim this, I am signing this object:

@rootux
rootux / mwt.py
Last active June 12, 2018 11:50 — forked from jh0ker/mwt.py
Memoize-with-timeout decorator
#!/usr/bin/env python
# Source: http://code.activestate.com/recipes/325905-memoize-decorator-with-timeout/#c1
import time
class MWT(object):
"""Memoize With Timeout"""
_caches = {}
_timeouts = {}
@rootux
rootux / playing_with_processes.py
Last active January 7, 2019 19:08
Playing with processes (Helping a brother out)
import os
import sys
import random
import time
import tempfile
from datetime import datetime
from multiprocessing import Process
from utils import is_number