Skip to content

Instantly share code, notes, and snippets.

View thaliaarchi's full-sized avatar

Thalia Archibald thaliaarchi

View GitHub Profile
@farhadi
farhadi / rc4.js
Created March 24, 2012 17:09
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
@tomykaira
tomykaira / partial_evaluation.md
Created July 22, 2012 14:55
Partial Evaluation, Futamura Projection And Their Applications

Partial Evaluation, Futamura Projection And Their Applications

What Partial Evaluation Is?

Partial evaluation means to fix some variables in the given code before execution. With a traditional implementation of a compiler or an interpreter, all variables are replaced with its value on each evaluation of that variable. This is because a variable can change at any timing. This is, however, not always true in actual applications. Almost all of large applications has setting variables and data

@guilherme
guilherme / gist:9604324
Last active July 4, 2024 01:17
Git pre-commit hook that detects if the developer forget to remove all the javascript console.log before commit.
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
# enable user input
exec < /dev/tty
consoleregexp='console.log'
# CHECK
if test $(git diff --cached | grep $consoleregexp | wc -l) != 0
then
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Last active November 22, 2016 11:19
Generated by SassMeister.com.
// ----
// Sass (v3.4.9)
// Compass (v1.0.1)
// ----
@function is-number($value) {
@return type-of($value) == 'number';
}
@function is-time($value) {
@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@Cartexius
Cartexius / install_gtest_ubuntu.md
Last active May 28, 2024 06:01
Install gtest in Ubuntu

Buttons

- import RaisedButton from 'material-ui/RiasedButton';
+ import Button from '@material-ui/core/Button';
- import ArrowBack from 'material-ui/svg-icons/navigation/arrow-back';
+ import ArrowBack from '@material-ui/icons/ArrowBack';
import { Link } from 'react-router-dom';

+ const styles = theme => ({
@Tomassito
Tomassito / download-file.js
Last active March 11, 2022 23:53 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
link.click();
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@mildsunrise
mildsunrise / flatten.py
Last active September 17, 2021 12:39
Git history flattener https://twitter.com/mild_sunrise/status/1300181598306996224 (needs GitPython)
#!/usr/bin/env python3
from git import Repo, Commit
list_commits = lambda commits: '\n'.join(' {} {}'.format(n.hexsha[:8], n.message.splitlines()[0]) for n in commits)
repo = Repo.init('path to bare clone', bare=True, mkdir=False)
refs = repo.refs
# load whole graph
def visit_graph(roots, get_parents=lambda n: n.parents):
queue = list(roots)