Skip to content

Instantly share code, notes, and snippets.

View alebianco's full-sized avatar

Alessandro Bianco alebianco

View GitHub Profile
@seanaedmiston
seanaedmiston / devise.rb
Created August 21, 2011 10:53
Devise Omniauthable
...
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
config.authentication_keys = [ :login ]
@zackthehuman
zackthehuman / cycle.frag
Created November 11, 2012 10:02
Color/palette cycling using GLSL (example in SFML)
uniform sampler2D texture;
uniform sampler2D colorTable;
uniform float paletteIndex;
void main()
{
vec2 pos = gl_TexCoord[0].xy;
vec4 color = texture2D(texture, pos);
vec2 index = vec2(color.r + paletteIndex, 0);
vec4 indexedColor = texture2D(colorTable, index);
package async
{
public class Deferred implements Promise
{
private const pending:Array = [];
private var processed:Boolean;
private var completed:Boolean;
@giuseppeg
giuseppeg / fuzzbuzz.js
Last active July 6, 2022 08:55
FizzBuzz solution with just one comparison:Bitwise operations, using predefined 0-15 numbers masksource: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
// FizzBuzz solution with one comparison:
// Bitwise operations, using predefined 0-15 numbers mask
// live demo: http://jsfiddle.net/TbAuQ/
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"],
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00
c = 0;
@jonathantneal
jonathantneal / .htaccess
Last active July 23, 2019 13:16
WebP support with fallback for all browsers
AddType image/webp webp
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Chrome [OR]
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_URI} ^(.+)\.(gif|jpe?g|png)$ [NC]
RewriteRule . %1.webp [T=image/webp,E=accept:1]
@jasononeil
jasononeil / Module1.hx
Created September 6, 2013 02:16
**Compile to separate JS Files in Haxe** In this example 1) SharedCode is compiled to sharedcode.js and must be loaded first 2) Both Module1 and Module2 reference SharedCode, but do not duplicate it's code. Look at the resulting Javascript to see the output. You would have to ensure sharedcode.js is loaded before either of the module javascript …
class Module1
{
static function main() {
SharedCode.greet("Jason");
}
}

For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:

First method (override Material UI classnames):

1 - Add the property classes in the AppBar component:

    <AppBar classes={{root: 'my-root-class'}}