Skip to content

Instantly share code, notes, and snippets.

@evandempsey
evandempsey / shopify_app_bridge_token_django_rest_framework.py
Last active December 7, 2023 01:18
Setting up token authentication for Shopify App Bridge embedded apps in Django with Django Rest Framework
# Put the following in shopify_app.authentication.py. This assumes we have a
# custom User model in shopify_app.models with a unique myshopify_domain
# attribute. The Shopify app API key and shared secret are imported from
# settings.py.
import datetime
import jwt
from datetime import timezone
from rest_framework import authentication
from rest_framework import exceptions
@kamalptw
kamalptw / Metronic Theme in Rails (Or any other framework)
Last active March 1, 2023 09:01
If you have a Metronic theme and want to use it in rails or any other framework..
Copy tools to root of project
Copy src of your final selected demo to lib/src
Open tools/gulp.config.json
Paste this
{
"config": {
"path": {
"src": "../lib/src"
},
"dist": [
@wangruohui
wangruohui / Install NVIDIA Driver and CUDA.md
Last active April 23, 2024 02:03
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@gmccreight
gmccreight / master.vim
Last active September 23, 2023 08:41
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@lifthrasiir
lifthrasiir / README.txt
Created July 10, 2011 19:04
A little program that converts "a hundred" to "100". (Updated!)
These little programs read a spelt (EDIT: it is not "spoken") number from the
standard input and write the corresponding number to the standard output. Weigh
just 243 bytes and 227 bytes of C. (EDIT: was originally 256 and 240 bytes.)
The longer version handles numbers up to 999,999,999,999,999, that is, just
shy of 1,000 trillions. The shorter version handles numbers up to 19,999,999,
or 999,999,999 if your "int" is 64 bits long. The input should be correct,
although it will handle "a" and "and" correctly and ignore some invalid
words.
@ameerkat
ameerkat / fib3.cpp
Created June 14, 2011 21:39
Calculating Fibonacci numbers with matrices
/* Fibonacci Calculation using Matrices
* Ameer Ayoub <ameer.ayoub@gmail.com>
* Jun 13, 2011
*/
#include <iostream>
#include <math.h>
using namespace std;
const int fib_matrix_size = 2;
@ameerkat
ameerkat / inc_v_num.py
Created May 19, 2011 01:20
Increment version number in drupal module info file
# increment_version_num.py
# Utility to incremement version number in drupal info files
# Ameer Ayoub <ameer.ayoub@gmail.com>
import re, sys, os
major_v = 0
minor_v = 0
def inc_dv_num(s, minor = True):
global major_v, minor_v
@jeresig
jeresig / .vimrc
Created May 4, 2011 16:46
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
@ameerkat
ameerkat / euler39optimized.py
Created April 5, 2011 04:28
Fully optimized euler #39!
from fractions import gcd
def euler39optimized():
sum_count = [0] * 1001
y = 2
while y**2 <= 500:
for z in [x for x in range(y) if gcd(y, x) == 1]:
a = y**2 - z**2
b = 2*y*z
c = y**2 + z**2