Skip to content

Instantly share code, notes, and snippets.

@xtbl
xtbl / tweet_image_dumper.py
Created April 21, 2020 20:52 — forked from freimanas/tweet_image_dumper.py
Get twitter user's photo url's from tweets - download all images from twitter user
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
import sys
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
@xtbl
xtbl / Git Alias.gitconfig
Last active January 30, 2017 17:49
Git Aliases
[user]
name = abc
email = abc
[alias]
co = checkout
fum = !git fetch upstream && git merge upstream/dev
addcom = !git add -A && git commit -m
st = status
codomain = !git checkout src/app/components/common/constants/domains/domains.js
removeallbranches = git branch | grep -v "master" | xargs git branch -D
@xtbl
xtbl / angularjs-testing-resource.js
Created January 21, 2014 20:22
AngularJS unit test using $resource
// verify you are not injecting 'ngMockE2E' for mock backend when working on unit tests
// and delete/comment mock backend stuff
// use httpBackend.flush() with $resource http://davidjs.com/2013/09/tricky-unit-testing-of-httpbackend/
// http://blogs.burnsidedigital.com/2013/09/and-httpbackend-mock-for-all-unit-e2e-testings/
describe( 'AppCtrl', function() {
describe( 'isCurrentUrl', function() {
var AppCtrl, $location, $scope;
var httpBackend;
@xtbl
xtbl / angularjs-interceptor-example.js
Last active January 3, 2016 11:39
AngularJS $interceptor example
// app.js
// http://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/
// http://blog.brunoscopelliti.com/http-response-interceptors
//any 404 error clean cookies and sends the user to login
var interceptor = ['$rootScope', '$q', '$location', '$cookieStore', function ($rootScope, $q, $location, $cookieStore) {
function success(response) {
@xtbl
xtbl / How To Install MongoDB On Mac OS X.md
Created January 1, 2014 23:14
How To Install MongoDB On Mac OS X
@xtbl
xtbl / Recursive Each.js
Last active January 1, 2016 09:49
get all the keys of an object
it('should get all the keys of an object', function() {
var selectedTile = { $$hashKey: 'testId', obj1:'test', obj2:5, obj3:{ test1:'test',test2:{a:1,b:2} } };
var selectedTile2 = { $$hashKey: 'testId', obj1:'test', obj2:5, obj3:{ test1:'test' } };
var keyList = [];
var recursiveEach = function(obj, customFunc) {
// using recursive each because _.each/_.keys only gets first level properties
for (var k in obj) {
if (typeof obj[k] == "object" && obj[k] !== null){
customFunc(k);
@xtbl
xtbl / deepDiffMapper
Created December 5, 2013 21:44
Find differences in JS objects
var deepDiffMapper = function() {
return {
VALUE_CREATED: 'created',
VALUE_UPDATED: 'updated',
VALUE_DELETED: 'deleted',
VALUE_UNCHANGED: 'unchanged',
map: function(obj1, obj2) {
if (this.isFunction(obj1) || this.isFunction(obj2)) {
throw 'Invalid argument. Function given, object expected.';
}
@xtbl
xtbl / Git Cheat sheet
Last active December 28, 2015 21:39
Git Cheat sheet
Setup
-----
How to undo (almost) anything with Git
https://github.com/blog/2019-how-to-undo-almost-anything-with-git
git clone <repo>
clone the repository specified by <repo>; this is similar to "checkout" in
some other version control systems such as Subversion and CVS
@xtbl
xtbl / JavaScript Module
Last active December 17, 2015 18:09
JavaScript Module
var myModule = (function (){
var counter = 0;
function increment() {
counter += 1;
return counter;
}
function decrement() {
counter -= 1;
return counter;