Skip to content

Instantly share code, notes, and snippets.

View gwuah's full-sized avatar
🎯
Focusing

Kwaw gwuah

🎯
Focusing
View GitHub Profile
@gwuah
gwuah / gist:68ca65af3b1fb2a39af22e67918ee5c1
Created June 2, 2017 06:22 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@gwuah
gwuah / get_all_followers.py
Created November 11, 2017 14:45
sample python snippet to retrieve all followers of a user using the tweepy wrapper
import tweepy
API_KEY = ''
API_TOKEN = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
def authenticate():
auth = tweepy.OAuthHandler(API_KEY, API_TOKEN)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
@gwuah
gwuah / twitter-auth-keys-extractor.js
Created January 12, 2018 15:59
this script contains a function that scrapes api keys for your twitter app.. just run it in console and claim your object
const getData = (self) => $(self).siblings().html()
function authKeys() {
const main = {} ;
$("span").each(function(el) {
switch ($(this).text()) {
case "Consumer Key (API Key)" :
main.consumer_key = getData(this)
break;
@gwuah
gwuah / cart.js
Last active May 30, 2018 11:19
A simple cart store that can be used to persist state across all components and pages. no need VueX
import Vue from 'vue';
export const Store = new Vue({
data: function () {
return {
cart: [],
tax: 0,
totalItemsInCart: 0
}
},
@gwuah
gwuah / hello_world.py
Created July 28, 2018 06:06
Hello World Examples
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
@gwuah
gwuah / ewew.py
Created July 28, 2018 15:02
trtrt
​x1this ins markdownjshdsjusudfdufgudggfdf
const Ottis = require('../lib');
const router = Ottis.router;
const {admin, customer} = require('./permissions');
/* Initialise Ottis with various roles */
const auth = Ottis(["admin","customer"]);
/* Admin Config */
auth.addConfigFor('admin').forResource('customers')({
config: admin.customers
const User = require('./authConfig.js');
function authorizeRequestTo(resource) {
return (req, res, next) {
/*
This is all on you. You can decide to populate
the user's rolename on a different variable
(other than roleName). This just an example.
*/
const roleName = req.user.role.toLowercase();
const Ottis = require('Ottis');
const router = Ottis.router;
/* easily declare your route permissions. */
/* can make only post, get, and put requests to /users */
router("/users").post().get().put().done();
/* can make any type of http request to /users */
router("/products").all();
/*
ottisConfig.js will be created later.
but for now lets' assume it contains
our configurations/permissions.
*/
const User = require('./ottisConfig');
const requestObj = {}; // http request object
// this returns either true or false.