Skip to content

Instantly share code, notes, and snippets.

View anthony-dandrea's full-sized avatar

Anthony D'Andrea anthony-dandrea

  • Milwaukee, WI
View GitHub Profile
@anthony-dandrea
anthony-dandrea / gist:0f39eab2607f54d09a02
Last active August 29, 2015 14:07
Eloquent JS Ch. 4
var range = function(start, end, step){
var range = [];
if (step === undefined) { step = 1;} //fuck you JS
var pushToRange = function(num) {
range.push(num);
};
if (start < end) {
for (var num = start; num <= end; num += step) {
@anthony-dandrea
anthony-dandrea / hw_nov_12_2014
Last active August 29, 2015 14:08
HW Nov 12th 2014
// 1. I feel like you already answered the question.
// But say if the very first case in winCombos is a win,
// the reduce method will go through the rest of the cases
// regards of the early win find.
// 2. 21 times because total of 8 winCombos and 3 within
// each. So 8 - 1 = 7, 7 * 3 21.
// 3. When it would be iterating through the last winCombos
// and finds the [0] != [1] in the array.
@anthony-dandrea
anthony-dandrea / gist:2dc50bc8143bfd02ad17
Last active August 29, 2015 14:19
Python Webassets example

In my site.py I just need to import webassets. I'm using the flask flavor but there's one for every major python framework. https://webassets.readthedocs.org/en/latest/

from flask.ext.assets import Environment, Bundle

Then in my base.html for sass/compass and css minification I have a filter like this:

{% assets filters='compass,scss,cssmin', depends='styles/**/*.scss', output='styles/site.min.css', 'styles/site.scss'%}
  <link rel="stylesheet" type="text/css" href="{{ ASSET_URL }}">
{% endassets %}
"""
For reference I'm trying to create a Pelican plugin
that will load templates from a python package before
loading the regular template path in the repo.
https://github.com/getpelican/pelican/blob/807b3bced38bff7b83a2efa2ce8cda9d644ebad3/pelican/generators.py#L61-L70
http://docs.getpelican.com/en/3.5.0/plugins.html#list-of-signals
"""
class Generator(object):

I pretty much just followed the directions here - http://scottjehl.github.io/picturefill/ In my markup I have something like:

  <html>
    <head>
      <script src="scripts/vendor/picturefill.min.js"></script>
    </head>
    <body>
 
@anthony-dandrea
anthony-dandrea / idea.md
Last active August 29, 2015 14:26
scrty encryption flow idea

The user bigpapa logs in then wants to store a new password.

So they give the BE:

App/Site Name Passwd
Reddit.com foobz

The backend encrypts the password and stores this app/site name with their username with previous sites/apps stored in a db like so:

@anthony-dandrea
anthony-dandrea / iOSHack.md
Last active June 28, 2022 07:48
How to pop iOS locks

Pop App Locks

For these hacks the iPhone must be jailbroken. But there currently is a jailbreak available for iOS 8.4 and some below. 4 digit pins can be bruteforced unless there is a attempt limit. Even with the limit it can still be hacked but you would need to break the phone open to rig the power to cut before the attempt is registered. Example here.

For all of these you need:

  • Phone to be jailbroken
  • OpenSSH installed on the phone

###1) Dump the iOS Keychain

@anthony-dandrea
anthony-dandrea / reduxAndImmutable.md
Last active June 2, 2016 04:18
Write up of my immutable adventures

What is Redux?

A single state tree so React components can "talk" to each other. For example we click an "add to cart" button and want to +1 to the number in the header for cart items. The flow for changes in the tree go like so:

Components listening to click -> onclick redux action dispatches event -> reducer see's dispatch and if it corresponds to that event it will update state -> Components get new state passed down via props

^ If you're a react noob and it doesn't make much sense. Don't trip too hard because we're not talking about how redux works as much as immutablility.

What does immutable mean?

window.mghf = 1;
@anthony-dandrea
anthony-dandrea / vscode.json
Last active July 13, 2019 00:05
vscode settings
{
"workbench.iconTheme": "vscode-icons",
"window.zoomLevel": 0,
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.fontSize": 14,
"editor.renderWhitespace": "all",
"files.autoSave": "onFocusChange",
"files.insertFinalNewline": true,
"workbench.colorCustomizations":{