Skip to content

Instantly share code, notes, and snippets.

View belachkar's full-sized avatar
💻
Freelance

Ali Belachkar belachkar

💻
Freelance
View GitHub Profile
@EyasuTew
EyasuTew / replies.py
Created October 26, 2019 14:50 — forked from edsu/replies.py
Try to get replies to a particular set of tweets, recursively.
#!/usr/bin/env python
"""
Twitter's API doesn't allow you to get replies to a particular tweet. Strange
but true. But you can use Twitter's Search API to search for tweets that are
directed at a particular user, and then search through the results to see if
any are replies to a given tweet. You probably are also interested in the
replies to any replies as well, so the process is recursive. The big caveat
here is that the search API only returns results for the last 7 days. So

Eslint config

Additional Packages for eslint react compatibility

babel-eslint v.8 required for estlint v.4 and above.

Name Version
babel-eslint ^8
eslint-plugin-react *
@belachkar
belachkar / Count_down_sh.md
Created February 16, 2020 18:28
bash count down code

Bash Count Down

#!/bin/bash

echo
echo "==> Count down will start in 3 seconds"
echo
for sec in {1..6}
 do printf "\r %01d" $((7 - ${sec}))
@Dobby233Liu
Dobby233Liu / gtimedToSRT.js
Last active January 23, 2026 18:42
Translates YouTube timed text to SRT. WTFPL. WIP.
// parse-ms
// MIT License, copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
// Modified by Dobby233Liu in slight cooperation with MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,

Auth0 Rules

Set roles to a new user

function (user, context, callback) {

  const count = context.stats && context.stats.loginsCount ?
        context.stats.loginsCount :	0;
 

Reseting PG Database on Heroku

  1. Restart: heroku restart
  2. Reset the DB: heroku pg:reset DATABASE (no need to change the DATABASE)
  3. Migration: It depends on the framework.
    • heroku run rake db:migrate Or,
    • heroku run flask db upgrade depending the framework

On one line:

Angular material flex-layout

List

<div class="container"
     fxLayout="column"
     fxLayoutGap="10px">

  <mat-list fxFlex>
 

Angular Testing Directive - Injection Dependecy

Fixing error: "arguments not provided"

Files

  • highlight.directive.ts
  • highlight.directive.spec.ts
  • menu.component.html

Angular Protractor e2e testing: Make the browser waiting

Files

  • app.e2e-spec.ts
  • app.po.ts

Code example

app.e2e-spec.ts