Skip to content

Instantly share code, notes, and snippets.

# http://theoryapp.com/generate-slug-url-in-mysql/
#This checks text with special characters
SELECT * FROM schools WHERE
slug NOT RLIKE '^([a-z0-9]+\-)+[a-z0-9]+$';
#This updates special characters with dash
UPDATE reddit SET
title_slug = lower(title),
title_slug = replace(title_slug, '.', ' '),
title_slug = replace(title_slug, '\'', ''),
@ralphilius
ralphilius / OriginalActivity.java
Created July 8, 2015 16:06
ImageView Transitions
View cardImage = (ImageView) findViewById(R.id.cardImage);
cardImage.setTransitionName("cardImage");
ImageView cardImage = (ImageView) findViewById(R.id.cardImage);
cardImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//This is where the magic happens. makeSceneTransitionAnimation takes a context, view, a name for the target view.
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(MaterialActivity.this, cardImage, "cardImage");
Intent intent = new Intent(OriginalActivity.this, DetailActivity.class);
@ralphilius
ralphilius / ScrollAwareFABBehavior.java
Last active November 1, 2015 02:31
Scroll-aware FloatingActionBar - FAB
/*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ralphilius
ralphilius / config.txt
Last active April 5, 2016 04:48
Photoshop CC's Assets Generator for Android
default 100% mipmap-xxxhdpi/, 25% mipmap-mdpi/, 37.5% mipmap-hdpi/, 50% mipmap-xhdpi/, 75% mipmap-xxhdpi/
default 96px x 96px drawable-xxxhdpi/, 25% drawable-mdpi/, 37.5% drawable-hdpi/, 50% drawable-xhdpi/, 75% drawable-xxhdpi/
@ralphilius
ralphilius / custom.css
Created February 21, 2018 07:06
Pure CSS Ticker (Horizontal) by Lewis Carey https://codepen.io/lewismcarey/pen/GJZVoG
* {
box-sizing: border-box;
}
@-webkit-keyframes ticker {
0% {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
visibility: visible;
}
100% {
{
"set_attributes": {
"current_product_name": "Mặt Nạ Tinh Chất Vàng 24K - SIGNATURE PREMIUM GOLD AMPOULE MASK"
},
"messages": [
{
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
{
"set_attributes": {
"delivery_address": "19 Ho Van Hue, Phu Nhuan District, Ho Chi Minh City"
}
}
{
"messages": [
{
"attachment": {
"type": "template",
"payload": {
"template_type": "receipt",
"sharable": true,
"recipient_name": "Mark Zuckerberg",
"merchant_name": "Gomi Beauty Shop",
{
"messages": [
{
"attachment":{
"type":"template",
"payload":{
"template_type":"list",
"top_element_style":"large",
"elements":[
{
@ralphilius
ralphilius / submit.md
Created August 5, 2019 16:09 — forked from tanaikech/submit.md
Enhanced onEdit(e) using Google Apps Script

Enhanced onEdit(e) using Google Apps Script

onEdit(e) which is used for the Edit event on Spreadsheet has the old value as e.oldValue. The specifications for this are as follows.

  1. When an user edited a single "A1" cell, e of onEdit(e) shows hoge for e.oldValue and fuga for e.value.
  2. When an user edited the "A1:A2" multiple cells, e.oldValue and e.value of onEdit(e) are not shown anything.
  3. When an user copied and pasted from other cell, e.oldValue and e.value of onEdit(e) are not shown anything.

This sample script was created to retrieve both the edited values and the old values for the range of edited cells. This is the modified e.oldValue.