Skip to content

Instantly share code, notes, and snippets.

View test.rb
def test_reverse
input = "abc";
result = reverse(input);
assert_equal("cba", result);
View generate_pdf_from_image.rb
def generate_pdf_from_image(image_path,image_attributes)
#new implementation
#old implementation
View pdf_generator.rb
class PDFGenerator
def generate_pdf_from_text(text,font_attributes)
#Call the RGhost’s implementation
def generate_pdf_from_image(image_path,image_attributes)
#Call the LaTex’s implementation
leenasn / notification.js
Last active Oct 11, 2017
Push notification configure
View notification.js
import PushNotification from 'react-native-push-notification'
async componentDidMount(){
popInitialNotification: true,
requestPermissions: true,
// (required) Called when a remote or local notification is opened or received
onNotification(notification) {
console.log('NOTIFICATION:', notification)

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

View list_with_count.rb
[<% @users.each_with_index do |user, index| %>{
"id" : "<%= %>" ,
"name" : "<%= user.full_name.split.first %>",
"profile_image_url" : "<%= user.profile_image_thumbnail.remote_url %>"
}<%= ((index + 1) == @users.count)? "" : "," %><% end %>]
View list_with_size.rb
[<% @users.each_with_index do |user, index| %>{
"id" : "<%= %>" ,
"name" : "<%= user.full_name.split.first %>",
"profile_image_url" : "<%= user.profile_image_thumbnail.remote_url %>"
}<%= ((index + 1) == @users.size)? "" : "," %><% end %>]
leenasn / offset_id_fields_mysql.sql
Created Mar 18, 2011
An SQL script to offset the id fields across all tables in a DB.
View offset_id_fields_mysql.sql
This script is for updating the auto_increment field by an offset. The logic applied is
max(AUTO_INCREMENT) + current value in the table.
SET @db:='id_new';
select @max_id:=max(AUTO_INCREMENT) from information_schema.tables;
select concat('update ',table_name,' set ', column_name,' = ',column_name,'+',@max_id,' ; ') from information_schema.columns where table_schema=@db and column_name like '%id' into outfile 'update_ids.sql';
You can’t perform that action at this time.