Skip to content

Instantly share code, notes, and snippets.

View erikaheidi's full-sized avatar
🌟
busy creating

Erika Heidi erikaheidi

🌟
busy creating
View GitHub Profile
@erikaheidi
erikaheidi / arduino_ir.ino
Last active August 29, 2015 14:12
Arduino IRremote with generic keychan remote control
/*
* DEMO IRremote Receive using the retired generic keychan remote control form Sparkfun
* https://www.sparkfun.com/products/retired/10280
*
* IR Receiver on PIN 2
* @author Erika Heidi
*/
#include <IRremote.h>
@erikaheidi
erikaheidi / pomodoro.ino
Last active August 29, 2015 14:13
Arduino Pomodoro
/*
POMODORO 0.2
by @erikaheidi
January 2015
LED STATES:
starts blue - idle. When the button is clicked, it starts a pomodoro working phase. LED will be a red "breathing" style.
After the time is done, it will change to GREEN (static) - indicating that the pomodoro was completed and now you should go to a PAUSE
When clicking the button, the PAUSE phase will start (GREEN "BREATHING"). It will turn to RED (static) when the pause is done, indicating that
a new WORKING phase should follow. When the button is clicked, starts over with the WORKING phase (RED breathing LED) :)

Keybase proof

I hereby claim:

  • I am erikaheidi on github.
  • I am erikaheidi (https://keybase.io/erikaheidi) on keybase.
  • I have a public key whose fingerprint is FA32 E8B9 E641 510B BA22 F1B3 1E72 5495 DACB 5582

To claim this, I am signing this object:

@erikaheidi
erikaheidi / mentoring.md
Last active September 16, 2015 19:13
Mentorship Resources
@erikaheidi
erikaheidi / facebook_signed_request.php
Last active December 13, 2015 21:29
facebook signed request functions
function parse_signed_request($signed_request, $secret) {
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
// decode the data
$sig = base64_url_decode($encoded_sig);
$data = json_decode(base64_url_decode($payload), true);
if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
error_log('Unknown algorithm. Expected HMAC-SHA256');
return null;
<?php
/* on config.php you put your initialization stuff, like session start and bd connection */
require_once("includes/config.php");
$uri = $_SERVER['REQUEST_URI'];
/* default is index */
$pagina = "index";
if($uri != "/")
{
{
"require" : {
"silex/silex": "1.0.*@dev",
"twig/twig": ">=1.8,<2.0-dev",
"symfony/twig-bridge": "~2.1",
"symfony/config": "~2.1",
"symfony/yaml": "~2.1",
"symfony/translation": "~2.1"
}
}
<?php
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'locale_fallback' => 'en',
));
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
$translator->addLoader('yaml', new YamlFileLoader());
return $translator;
@erikaheidi
erikaheidi / app.php
Last active December 15, 2015 04:19
<?php
$lang = "en";
if ($app['session']->get('current_language')) {
$lang = $app['session']->get('current_language');
}
foreach (glob(__DIR__ . '/locale/'. $lang . '/*.yml') as $locale) {
$app['translator']->addResource('yaml', $locale, $lang);
}
<?php
$app->get('/lang/{lang}', function($lang) use($app) {
/*
* check if language exists
*/
if (is_dir(__DIR__ . '/locale/' . $lang)) {
/* save user selection in session */
$app['session']->set('current_language', $lang);
}